Skip to content

[GR-80787] GitHub PRs #1227-1232 - #1242

Merged
graalvmbot merged 10 commits into
masterfrom
msimacek/GR-80787-GitHub_PRs_1227-1232
Oct 23, 2026
Merged

graalvmbot merged 10 commits into
masterfrom
msimacek/GR-80787-GitHub_PRs_1227-1232

Conversation

@graalvmbot

Copy link
Copy Markdown
Collaborator

No description provided.

jseop-lim and others added 10 commits October 20, 2026 11:21
complexFromComplexObject, the specialization taken when imag is
neither a complex nor a string, called imag's __float__ before it
looked at real, so an exception from that conversion replaced the
first-argument TypeError and complex(Real(), Imag()) converted imag
first.

CPython's complex_new_impl checks the type of real, then of imag, and
only then converts real followed by imag. The specialization now does
the same; the (Object, long/double/PInt) specializations already
check real first.

Signed-off-by: Jeongseop Lim <jeongseop_lim@korea.ac.kr>
compile() resolved mode with getParserInputType only inside the
string compile path, after sourceAsString had converted the source and
checkSource had looked for null bytes, and checked that func_type comes
with PyCF_ONLY_AST later still. So compile(None, 'f', 'x') raised
TypeError, a source with a null byte or bytes that fail to decode
raised SyntaxError, and an AST source with mode 'func_type' but no
PyCF_ONLY_AST reached obj2sst and hit ShouldNotReachHere. CPython
reports all of these as ValueError.

CPython's builtin_compile_impl validates mode, including the func_type
flag requirement, right after the flags and optimize checks and before
it touches the source. getParserInputType now does the func_type
check, generic resolves the input type at that point and reuses it for
the AST path, and compile() resolves it before checkSource.

Signed-off-by: Jeongseop Lim <jeongseop_lim@korea.ac.kr>
The __reversed__ methods of dict, dict_keys, dict_items and
dict_values wrapped the reverse storage iterator with the forward
factories, so reversed(d) was a dict_keyiterator and
type(reversed(d)) is type(iter(d)) held. The PDictReverse*Iterator
types were still defined and registered with IteratorBuiltins, but
nothing created them since afc1f12 dropped the reverse factories.

Restore createDictReverse{Key,Item,Value}Iterator in their former
shape and use them at the four sites, as CPython builds these
iterators from the PyDictRevIter*_Type types.

Signed-off-by: Jeongseop Lim <jeongseop_lim@korea.ac.kr>
BytesCommonBuiltins.DecodeNode, which backs bytes.decode,
bytearray.decode and str(obj, encoding), always went through the
codec, so b''.decode('bogus') and str(b'', 'bogus') raised
LookupError.

CPython's bytes and bytearray decode call PyUnicode_FromEncodedObject,
which returns '' for empty input without looking up the codec outside
dev mode. GraalPy's own PyUnicodeFromEncodedObject already does this
for the C API; DecodeNode now has the same shortcut.

Signed-off-by: Jeongseop Lim <jeongseop_lim@korea.ac.kr>
checkFlags called PRaiseNode.raiseStatic(this, ValueError, null,
NO_VALUE, UNRECOGNIZED_FLAGS, EMPTY_OBJECT_ARRAY), mirroring the
argument order of the old internal execute(). No public overload takes
those arguments, so the call bound to raiseStatic(Node, type, message,
Object...) with a null message and the intended message as a format
argument. The ValueError could be caught, but str(), repr() or .args on
it formatted the null message and threw a Java NullPointerException.

Use the message overload, as checkOptimize next to it does. CPython
raises ValueError("compile(): unrecognised flags").

Signed-off-by: Jeongseop Lim <jeongseop_lim@korea.ac.kr>
@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Oct 23, 2026
@graalvmbot
graalvmbot merged commit bf582d8 into master Oct 23, 2026
13 of 17 checks passed
@graalvmbot
graalvmbot deleted the msimacek/GR-80787-GitHub_PRs_1227-1232 branch October 23, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants