curses.complexstr returns Py_NotImplemented from its sq_concat slot for a non-complexstr operand, and PyNumber_Add() returns an sq_concat result verbatim, so the singleton reaches Python code instead of a TypeError.
import curses
s = curses.complexstr('ab')
print('s + "x" ->', repr(s + 'x'))
s += 'x'
print('after s += "x":', repr(s))
s + "x" -> NotImplemented
after s += "x": NotImplemented
Expected: TypeError from both. The augmented assignment is the same slot, so it silently rebinds the name to NotImplemented rather than failing.
complexstr is new in 3.16, so no released version is affected.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
curses.complexstrreturnsPy_NotImplementedfrom itssq_concatslot for a non-complexstroperand, andPyNumber_Add()returns ansq_concatresult verbatim, so the singleton reaches Python code instead of aTypeError.Expected:
TypeErrorfrom both. The augmented assignment is the same slot, so it silently rebinds the name toNotImplementedrather than failing.complexstris new in 3.16, so no released version is affected.CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs