diff options
author | Christian Tismer <tismer@stackless.com> | 2021-09-09 16:05:18 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2021-09-10 13:54:34 +0200 |
commit | fabf40e4dce39a8427480ca6836ae3e806368eee (patch) | |
tree | ea497ddbfea6f19716f83f0f06613f2c7f8c0f0e /sources/shiboken6/generator/shiboken/cppgenerator.cpp | |
parent | 47885c3c9d1ca4eb13daf79a0f6c73c8fce350cc (diff) |
PyPySide: fix the representation of missing keyword arguments
It CPython, missing keyword arguments are encoded by passing
a nullptr as dict. Not so in PyPy, where no keyword arguments
simply result in empty dicts.
[ChangeLog][PySide6] PyPySide: Accept empty dicts as
alternative to setting unused keyword dicts to nullptr.
This saves about 40 errors :-) (still 195 due to inheritance)
Task-number: PYSIDE-535
Change-Id: I40c12e82d8a445272698264f0a04f48533f56f88
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/shiboken6/generator/shiboken/cppgenerator.cpp')
-rw-r--r-- | sources/shiboken6/generator/shiboken/cppgenerator.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp index bc173d8a6..5645043a6 100644 --- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp +++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp @@ -3374,7 +3374,8 @@ void CppGenerator::writeNamedArgumentResolution(TextStream &s, const AbstractMet const AbstractMetaArgumentList &args = OverloadData::getArgumentsWithDefaultValues(func); if (args.isEmpty()) { if (overloadData.hasArgumentWithDefaultValue()) { - s << "if (kwds) {\n"; + // PySide-535: Allow for empty dict instead of nullptr in PyPy + s << "if (kwds && PyDict_Size(kwds) > 0) {\n"; { Indentation indent(s); s << "errInfo.reset(kwds);\n" @@ -3386,7 +3387,8 @@ void CppGenerator::writeNamedArgumentResolution(TextStream &s, const AbstractMet return; } - s << "if (kwds) {\n"; + // PySide-535: Allow for empty dict instead of nullptr in PyPy + s << "if (kwds && PyDict_Size(kwds) > 0) {\n"; { Indentation indent(s); s << "PyObject *value{};\n" |