Skip to content

[GH-676] Fix wrong type name in __repr__ TypeError message#677

Closed
jseop-lim wants to merge 1 commit intooracle:masterfrom
jseop-lim:GH676-fix-repr
Closed

[GH-676] Fix wrong type name in __repr__ TypeError message#677
jseop-lim wants to merge 1 commit intooracle:masterfrom
jseop-lim:GH676-fix-repr

Conversation

@jseop-lim
Copy link

@jseop-lim jseop-lim commented Mar 13, 2026

Description

Fixes #676.

When __repr__ returns a non-string value, the TypeError message incorrectly reports the type of the object being repr'd instead of the return value's type, diverging from CPython.

AS-IS

TypeError: __repr__ returned non-string (type A)

(type of the object)

TO-BE

TypeError: __repr__ returned non-string (type bool)

(type of the return value, matching CPython)

Change

Pass result (the __repr__ return value) instead of obj (the object being repr'd) to raiseTypeError in PyObjectReprAsObjectNode.java. The equivalent __str__ path in PyObjectStrAsObjectNode.java already does this correctly.

@oracle-contributor-agreement
Copy link

Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
The following contributors of this PR have not signed the OCA:

To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.

When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.

If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. label Mar 13, 2026
Signed-off-by: Jeongseop Lim <jeongseop_lim@korea.ac.kr>
@jseop-lim
Copy link
Author

sorry for wrong email in sign.

@jseop-lim jseop-lim closed this Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Required At least one contributor does not have an approved Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: __repr__ TypeError reports wrong type in error message

1 participant