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

[3.5] bpo-29960 _random.Random corrupted on exception in setstate(). … #1288

Merged
merged 2 commits into from May 27, 2017

Conversation

Mariatta
Copy link
Member

…(GH-1019).

(cherry picked from commit 9616a82)

@Mariatta Mariatta added the type-bug An unexpected behavior, bug, or error label Apr 26, 2017
@@ -313,6 +313,7 @@ random_setstate(RandomObject *self, PyObject *state)
int i;
unsigned long element;
long index;
uint32_t new_state[N];
Copy link
Member

Choose a reason for hiding this comment

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

Use PY_UINT32_T rather than uint32_t.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated.

@@ -329,7 +330,7 @@ random_setstate(RandomObject *self, PyObject *state)
element = PyLong_AsUnsignedLong(PyTuple_GET_ITEM(state, i));
if (element == (unsigned long)-1 && PyErr_Occurred())
return NULL;
self->state[i] = (PY_UINT32_T)element;
new_state[i] = (uint32_t)element;
Copy link
Member

Choose a reason for hiding this comment

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

Use PY_UINT32_T rather than uint32_t.

@codecov
Copy link

codecov bot commented May 27, 2017

Codecov Report

Merging #1288 into 3.5 will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##              3.5    #1288      +/-   ##
==========================================
+ Coverage   83.47%   83.48%   +<.01%     
==========================================
  Files        1343     1343              
  Lines      335776   335780       +4     
==========================================
+ Hits       280294   280312      +18     
+ Misses      55482    55468      -14
Impacted Files Coverage Δ
Lib/test/test_random.py 98.21% <100%> (-0.21%) ⬇️
Lib/test/test_ssl.py 87.86% <0%> (ø) ⬆️
Lib/test/lock_tests.py 86.91% <0%> (+0.14%) ⬆️
Lib/plistlib.py 90.95% <0%> (+0.17%) ⬆️
Lib/multiprocessing/queues.py 68.39% <0%> (+1.29%) ⬆️
Lib/heapq.py 98.85% <0%> (+3.81%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d51d093...df62d88. Read the comment docs.

@Mariatta Mariatta merged commit 440bc4f into python:3.5 May 27, 2017
@Mariatta Mariatta deleted the backport-9616a82-3.5 branch May 27, 2017 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants