[issue40425] Refleak in CDataObject

2020-04-28 Thread Cubi


New submission from Cubi :

String buffers are not freed when pointers to them (created via ctypes.cast) 
are deleted, even though those pointers hold references to the string buffer 
(in tagCDataObject.b_objects, I think). Code examples can be found on 
StackOverflow.com [1]. Thanks to Mark Tolonen's answer on that StackOverflow 
post we know that it is a refcount problem.

Tested in
  Python v3.7.4 x64 on Windows 10 x64, and in
  Python v3.8.2 x64 on ArchLinux x64 (5.6.7-arch1-1)

[1] https://stackoverflow.com/q/61479041

--
components: ctypes
messages: 367549
nosy: cubinator
priority: normal
severity: normal
status: open
title: Refleak in CDataObject
type: resource usage
versions: Python 3.8

___
Python tracker 
<https://bugs.python.org/issue40425>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29751] PyLong_FromString fails on decimals with leading zero and base=0

2017-03-07 Thread Cubi

New submission from Cubi:

Calling PyLong_FromString(str, NULL, 0) fails, if str is a string containing a 
decimal number with leading zeros, even though such strings should be parsed as 
decimal numbers according to the documentation:

"If base is 0, the radix will be determined based on the leading characters of 
str: if str starts with '0x' or '0X', radix 16 will be used; if str starts with 
'0o' or '0O', radix 8 will be used; if str starts with '0b' or '0B', radix 2 
will be used; otherwise radix 10 will be used"

Examples:
PyLong_FromString("15", NULL, 0); // Returns int(15) (Correct)
PyLong_FromString("0xF", NULL, 0); // Returns int(15) (Correct)
PyLong_FromString("015", NULL, 0); // Should return int(15), but raises 
ValueError: invalid literal for int() with base 0: '015'

Version information:
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit 
(AMD64)] on win32

--
components: Interpreter Core
messages: 289188
nosy: cubinator
priority: normal
severity: normal
status: open
title: PyLong_FromString fails on decimals with leading zero and base=0
type: behavior
versions: Python 3.5

___
Python tracker 
<http://bugs.python.org/issue29751>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com