Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-23578: Show which offset raise error when using struct.pack #291

Closed
wants to merge 7 commits into from
Closed

bpo-23578: Show which offset raise error when using struct.pack #291

wants to merge 7 commits into from

Conversation

louisom
Copy link
Contributor

@louisom louisom commented Feb 25, 2017

Adding PyErr_SetString and PyErr_Format wrapper, with a global offset
variable to handle this.

struct.pack('!h', 0x8FFFF)
Traceback (most recent call last):
  File "tests.py", line 5, in <module>
    struct.pack('!h', 0x8FFFF)
struct.error: Raise at offset 1, 'h' format requires -32768 <= number <= 32767

@rhettinger
Copy link
Contributor

This looks like a reasonable improvement.

@louisom
Copy link
Contributor Author

louisom commented Apr 5, 2017

@rhettinger I'm not sure about the global variable. Is there any way to test if global variable has the defect when using threads?

louisom added 5 commits April 16, 2017 18:56
Adding PyErr_SetString and PyErr_Format wrapper, with a global offset
variable to handle this.

>>> struct.pack('!h', 0x8FFFF)
Traceback (most recent call last):
  File "tests.py", line 5, in <module>
    struct.pack('!h', 0x8FFFF)
struct.error: Raise at offset 1, 'h' format requires -32768 <= number <= 32767
@louisom
Copy link
Contributor Author

louisom commented Apr 16, 2017

@serhiy-storchaka I removed the global offset variable, and add a new parameter pos to corresponding function. Not sure this kind of big change is better than global variable or not.

Could you help me review this? Thanks.

@serhiy-storchaka serhiy-storchaka self-requested a review April 16, 2017 16:45
@serhiy-storchaka serhiy-storchaka added the type-feature A feature request or enhancement label Dec 8, 2018
Copy link

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plz re base

@csabella
Copy link
Contributor

This change is from an unknown repository and this GitHub account is no longer active. I'm going to close this PR so that another one could be opened to replace it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting core review type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants