Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(80925)

#20519: ctypes.create_string_buffer creates reference cycles

Can't Edit
Can't Publish+Mail
Start Review
Created:
5 years, 9 months ago by gjcarneiro
Modified:
4 years ago
Reviewers:
victor.stinner
CC:
amaury.forgeotdarc, sasha, gustavo, AntoinePitrou, haypo, ned.deily, r.david.murray, meadori, storchaka
Visibility:
Public.

Patch Set 1 #

Total comments: 6

Patch Set 2 #

Total comments: 4

Patch Set 3 #

Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Lib/test/test_uuid.py View 1 2 1 chunk +8 lines, -0 lines 0 comments Download
Lib/uuid.py View 1 2 9 chunks +78 lines, -36 lines 0 comments Download
Modules/_uuidmodule.c View 1 2 1 chunk +45 lines, -0 lines 0 comments Download
setup.py View 1 2 1 chunk +14 lines, -0 lines 0 comments Download

Messages

Total messages: 4
victor.stinner_gmail.com
http://bugs.python.org/review/20519/diff/10941/Modules/_uuidmodule.c File Modules/_uuidmodule.c (right): http://bugs.python.org/review/20519/diff/10941/Modules/_uuidmodule.c#newcode8 Modules/_uuidmodule.c:8: uuid_generate_random(out); Do you think that it's worth to release ...
4 years, 1 month ago #1
gustavo
I'll push a new patch that fixes the Mac OS X issue. http://bugs.python.org/review/20519/diff/10941/Modules/_uuidmodule.c File Modules/_uuidmodule.c ...
4 years ago #2
victor.stinner_gmail.com
https://bugs.python.org/review/20519/diff/15825/Lib/uuid.py File Lib/uuid.py (right): https://bugs.python.org/review/20519/diff/15825/Lib/uuid.py#newcode455 Lib/uuid.py:455: import ctypes, ctypes.util Maybe we should make this code ...
4 years ago #3
gustavo
4 years ago #4
I will upload a new patch that fixes these two issues.

I also noted that my previous patch completely broke the case when ctypes is
actually needed and used.  The new patch fixes that as well.  Also
_uuid.generate_time() from the extension module is now used (for the function
uuid1()) if available.

https://bugs.python.org/review/20519/diff/15825/Lib/uuid.py
File Lib/uuid.py (right):

https://bugs.python.org/review/20519/diff/15825/Lib/uuid.py#newcode455
Lib/uuid.py:455: import ctypes, ctypes.util
On 2015/10/27 03:35:14, haypo wrote:
> Maybe we should make this code specific to Windows? I don't expect other
> platforms to have "windll". I will avoid completly the ctypes import.

I made it so that ctypes is not imported if the _uuid module is available and is
usable.

https://bugs.python.org/review/20519/diff/15825/Modules/_uuidmodule.c
File Modules/_uuidmodule.c (right):

https://bugs.python.org/review/20519/diff/15825/Modules/_uuidmodule.c#newcode42
Modules/_uuidmodule.c:42: {
On 2015/10/27 03:35:14, haypo wrote:
> Can you please add:
> 
> assert(sizeof(uuid_t) == 16);
> 
> I didn't see how the structure is defined, but the previous Python
> implementation uses a buffer of exactly 16 bytes.

Added assert.  Module still imports, as expected.
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+