[issue32153] mock.create_autospec fails if an attribute is a partial function

2018-12-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10090

___
Python tracker 

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



[issue35242] multiprocessing.Queue in an inconsistent state and a traceback silently suppressed if put an unpickable object and process's target function is finished

2018-12-03 Thread Sergei Zobov


Sergei Zobov  added the comment:

So, should I just close this issue in case we've decided it's not a big problem?

--

___
Python tracker 

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



[issue32153] mock.create_autospec fails if an attribute is a partial function

2018-12-03 Thread Chris Withers


Chris Withers  added the comment:


New changeset 1ef06c62d3c05cbba6448c56af30a09c551c9ec2 by Chris Withers (Miss 
Islington (bot)) in branch '3.7':
bpo-32153: Add unit test for create_autospec with partial function returned in 
getattr (GH-10398) (#10855)
https://github.com/python/cpython/commit/1ef06c62d3c05cbba6448c56af30a09c551c9ec2


--

___
Python tracker 

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



[issue35382] Something wrong with pymysql

2018-12-03 Thread Leung


New submission from Leung :

when i use like that 
userinfo = dbsession2.query(func.count(radcheck1.username)).\
outerjoin(radcheck2,radcheck1.username==radcheck2.username).\
filter(radcheck1.admin_user==g.user.name,or_(radcheck1.username.like('im_%'),and_(radcheck1.attribute=='Cleartext-Password',radcheck2.attribute=='Expiration'))).
python3.6 is ok.But python 3.7 and 3.7.1 show me name 'byte2int' is not defined 
in pymysql/_auth.py

--
messages: 330910
nosy: leung
priority: normal
severity: normal
status: open
title: Something wrong with pymysql
type: compile error
versions: Python 3.7

___
Python tracker 

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



[issue10320] printf %qd is nonstandard

2018-12-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 062cbb67726f26794b1b461853e40696b4a0b220 by Serhiy Storchaka 
(Zackery Spytz) in branch 'master':
bpo-10320: Replace nonstandard sprintf() length modifier in ctypes' 
PyCArg_repr(). (GH-10853)
https://github.com/python/cpython/commit/062cbb67726f26794b1b461853e40696b4a0b220


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue10320] printf %qd is nonstandard

2018-12-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10091

___
Python tracker 

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



[issue10320] printf %qd is nonstandard

2018-12-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10092

___
Python tracker 

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



[issue10320] printf %qd is nonstandard

2018-12-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10093

___
Python tracker 

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



[issue35372] Code page decoder incorrectly handles input >2GiB

2018-12-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10094

___
Python tracker 

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



[issue35372] Code page decoder incorrectly handles input >2GiB

2018-12-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 4013c179117754b039957db4730880bf3285919d by Serhiy Storchaka in 
branch 'master':
bpo-35372: Fix the code page decoder for input > 2 GiB. (GH-10848)
https://github.com/python/cpython/commit/4013c179117754b039957db4730880bf3285919d


--

___
Python tracker 

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



[issue35372] Code page decoder incorrectly handles input >2GiB

2018-12-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10095

___
Python tracker 

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



[issue35382] Something wrong with pymysql

2018-12-03 Thread Mark Dickinson


Mark Dickinson  added the comment:

Hi Leung. This is the issue tracker for the core Python language (along with 
the standard library). PyMySQL is a third-party project: it isn't part of the 
standard library. I'd suggest reporting your issue directly to the PyMySQL 
maintainers.

(At a quick glance, https://github.com/PyMySQL/PyMySQL looks like the right 
place.)

--
nosy: +mark.dickinson
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue35382] Something wrong with pymysql

2018-12-03 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Also, for future reference, please spend the time to make a good bug report, 
showing the minimum code needed to reproduce the error, and the full error, not 
just a summary.

Please read this before your next bug report:

http://sscce.org/

Thank you.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue35382] Something wrong with pymysql

2018-12-03 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

It's a third party issue as others noted but just to add to this I found the 
below PR and question to be related to your problem in the tracker while 
googling byte2int pymysql that might be of help.

* 
https://stackoverflow.com/questions/51565646/pymysql-stopped-working-nameerror-name-byte2int-is-not-defined
* https://github.com/PyMySQL/PyMySQL/pull/713

Thanks

--
nosy: +xtreak -mark.dickinson, steven.daprano
resolution: third party -> 
stage: resolved -> 
status: closed -> open

___
Python tracker 

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



[issue35283] "threading._DummyThread" redefines "is_alive" but forgets "isAlive"

2018-12-03 Thread Dong-hee Na


Dong-hee Na  added the comment:

Hi, I am going to solve this issue through below process.

1. Implement `isAlive` for dummy thread
2. Updating docstrings to recommend use is_alive() instead of isAlive().
3. Add a deprecation warning for both Thread.isAlive and _DummyThread.isAlive
4. Remove isAlive in future Python release (3.8 for the deprecation, 3.8+2 for 
removal).
5. Backporting the property down to 3.7 and 3.6 doesn't hurt, let's do it

Is it okay?

--

___
Python tracker 

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



[issue35382] Something wrong with pymysql

2018-12-03 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Sorry, I messed up while adding the reply at the same time. Closing it again.

--
nosy: +mark.dickinson, steven.daprano
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue35372] Code page decoder incorrectly handles input >2GiB

2018-12-03 Thread miss-islington


miss-islington  added the comment:


New changeset bdeb56cd21ef3f4f086c93045d80f2a753823379 by Miss Islington (bot) 
in branch '3.7':
bpo-35372: Fix the code page decoder for input > 2 GiB. (GH-10848)
https://github.com/python/cpython/commit/bdeb56cd21ef3f4f086c93045d80f2a753823379


--
nosy: +miss-islington

___
Python tracker 

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



[issue10320] printf %qd is nonstandard

2018-12-03 Thread miss-islington


miss-islington  added the comment:


New changeset a9f435e5d856fb62516b70a78217e40b90bec233 by Miss Islington (bot) 
in branch '3.7':
bpo-10320: Replace nonstandard sprintf() length modifier in ctypes' 
PyCArg_repr(). (GH-10853)
https://github.com/python/cpython/commit/a9f435e5d856fb62516b70a78217e40b90bec233


--
nosy: +miss-islington

___
Python tracker 

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



[issue10320] printf %qd is nonstandard

2018-12-03 Thread miss-islington


miss-islington  added the comment:


New changeset f65ede3f8fa08493facf48177540d0ec26e59560 by Miss Islington (bot) 
in branch '3.6':
bpo-10320: Replace nonstandard sprintf() length modifier in ctypes' 
PyCArg_repr(). (GH-10853)
https://github.com/python/cpython/commit/f65ede3f8fa08493facf48177540d0ec26e59560


--

___
Python tracker 

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



[issue35372] Code page decoder incorrectly handles input >2GiB

2018-12-03 Thread miss-islington


miss-islington  added the comment:


New changeset 0f9b6687eb8b26dd804abcc6efd4d6430ae16f24 by Miss Islington (bot) 
in branch '3.6':
bpo-35372: Fix the code page decoder for input > 2 GiB. (GH-10848)
https://github.com/python/cpython/commit/0f9b6687eb8b26dd804abcc6efd4d6430ae16f24


--

___
Python tracker 

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



[issue35283] "threading._DummyThread" redefines "is_alive" but forgets "isAlive"

2018-12-03 Thread Dieter Maurer


Dieter Maurer  added the comment:

> Hi, I am going to solve this issue through below process.
> ...
> Is it okay?

For me, this would be perfect.

--

___
Python tracker 

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



[issue35155] Clarify Protocol Handlers in urllib.request Docs

2018-12-03 Thread Denton Liu


Denton Liu  added the comment:

Pinging for updates.

--

___
Python tracker 

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



[issue33337] Provide a supported Concrete Syntax Tree implementation in the standard library

2018-12-03 Thread Niklas Rosenstein


Niklas Rosenstein  added the comment:

Lukasz, have you created a 3rd party package branching off lib2to3? I'm working 
on a project that is based on it (in a similar usecase as YAPF and Black) and 
was hoping that there may be some version maintained distinctly from the Python 
release schedule.

--
nosy: +n_rosenstein

___
Python tracker 

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



[issue33529] [security] Infinite loop on folding email (_fold_as_ew()) if an header has no spaces

2018-12-03 Thread STINNER Victor


STINNER Victor  added the comment:

Since it's a denial of service which can be triggered by an user, I mark this 
issue as a security issue.

I can be wrong, but it seems like Python 2.7 isn't affected: 
Lib/email/_header_value_parser.py was added by bpo-12586 (commit 
0b6f6c82b51b7071d88f48abb3192bf3dc2a2d24). Python 2.7 doesn't have this file 
nor policies.

--
nosy: +vstinner
title: Infinite loop on folding email if headers has no spaces -> [security] 
Infinite loop on folding email (_fold_as_ew()) if an header has no spaces
type: behavior -> security
versions: +Python 3.7, Python 3.8

___
Python tracker 

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



[issue35383] lib2to3 raises ParseError on argument called "print"

2018-12-03 Thread Niklas Rosenstein


New submission from Niklas Rosenstein :

On Python 3.7.0 lib2to3 will not parse code like this:

def foo(print=None):
  pass

and yield the following error instead

lib2to3.pgen2.parse.ParseError: bad input: type=1, value='print', 
context=('', (1, 8))

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 330926
nosy: n_rosenstein
priority: normal
severity: normal
status: open
title: lib2to3 raises ParseError on argument called "print"
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue35377] urlsplit scheme argument broken

2018-12-03 Thread devkral


devkral  added the comment:

Ok, then the problem is in unsplit.
Because: :/// is not a valid url.

Next try: in urlunsplit:


if netloc or (scheme and scheme in uses_netloc and url[:2] != '//'):
if url and url[:1] != '/' and scheme in ("file", ""): # my change
url = '/' + url

--

___
Python tracker 

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



[issue35373] PyInit_timezone() must return a value

2018-12-03 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +10096
stage:  -> patch review

___
Python tracker 

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



[issue35373] PyInit_timezone() must return a value

2018-12-03 Thread STINNER Victor


STINNER Victor  added the comment:

Crap. My commit 503ce5c482cb267b0770bc46c315d5cf822bdca9 was supposed to fix on 
of the latest compiler warning in master, but I introduced a new warning :-( 
What a shame on me :-( I was too quick... PR 10861 should fix the new warning.

--

___
Python tracker 

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



[issue32477] Move jumps optimization from the peepholer to the compiler

2018-12-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Simplified PR 5077. It uses now NEXT_BLOCK() to guarantee that a new block is 
always used after jumps. NEXT_BLOCK() was defined, but not used before.

bpo-35193 and bpo-9566 demonstrate that the code of peephole.c is complex and 
error-prone. Moving it to the upper level makes it more error-proof and general.

--
versions: +Python 3.8 -Python 3.7

___
Python tracker 

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



[issue35372] Code page decoder incorrectly handles input >2GiB

2018-12-03 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue35377] urlsplit scheme argument broken

2018-12-03 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
pull_requests: +10097
stage:  -> patch review

___
Python tracker 

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



[issue35384] The repr of ctypes.CArgObject fails for non-ascii character

2018-12-03 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

The repr of the ctypes.CArgObject instance will fail when the value is a 
non-ascii character.

The code is:

sprintf(buffer, "",
self->tag, self->value.c);
...
return PyUnicode_FromString(buffer);

If self->value.c is out of range 0-127, buffer will contain a string not 
decodable with UTF-8.

There is a similar problem with non-ascii self->tag.

The following PR is purposed to fix this, but I don't know how to test it. 
Current tests only create CArgObject instances with tag='P' (in byref()).

--
components: Extension Modules, ctypes
messages: 330931
nosy: amaury.forgeotdarc, belopolsky, meador.inge, serhiy.storchaka
priority: normal
severity: normal
status: open
title: The repr of ctypes.CArgObject fails for non-ascii character
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue35384] The repr of ctypes.CArgObject fails for non-ascii character

2018-12-03 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +10099
stage:  -> patch review

___
Python tracker 

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



[issue35385] time module: why not using tzname from the glibc?

2018-12-03 Thread STINNER Victor


New submission from STINNER Victor :

Currently, the time module uses tm_zone and tm_gmtoff of struct tm with 
localtime_r() to get the timezone (name and offset) on my Fedora 29. But it 
seems like glibc provides "tzname", "daylight" and "timezone" variables. Why 
not using them?
 
Python also provides "altzone", I'm not sure how to get this value from the 
glibc. See also the documentation:

https://docs.python.org/dev/library/time.html#timezone-constants


It's not a bug, it's more a question :-)


It seems like the configure script always undefine HAVE_DECL_TZNAME:
---
/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
   */
#undef HAVE_DECL_TZNAME
---


Example of C program:
---
#include 
#include 
#include 

int main()
{
putenv("TZ=UTC");
tzset();
printf("tzname = {%s, %s}\n", tzname[0], tzname[1]);
exit(EXIT_SUCCESS);
}
---


Output on Fedora 29, glibc 2.28:
---
tzname = {UTC, UTC}
---


Note: tzname is not always defined by :
---
/* Defined in localtime.c.  */
extern char *__tzname[2];   /* Current timezone names.  */
extern int __daylight;  /* If daylight-saving time is ever in use.  */
extern long int __timezone; /* Seconds west of UTC.  */


#ifdef  __USE_POSIX
/* Same as above.  */
extern char *tzname[2];

/* Set time conversion information from the TZ environment variable.
   If TZ is not defined, a locale-dependent default is used.  */
extern void tzset (void) __THROW;
#endif

#if defined __USE_MISC || defined __USE_XOPEN
extern int daylight;
extern long int timezone;
#endif
---


configure should try to tzname is available no?


For HAVE_WORKING_TZSET, configure contains a C program which uses HAVE_TZNAME. 
Extract:
---
#if HAVE_TZNAME
extern char *tzname[];
#endif
...
putenv("TZ=UTC+0");
tzset();
if (localtime(&groundhogday)->tm_hour != 0)
exit(1);
#if HAVE_TZNAME
/* For UTC, tzname[1] is sometimes "", sometimes "   " */
if (strcmp(tzname[0], "UTC") ||
(tzname[1][0] != 0 && tzname[1][0] != ' '))
exit(1);
#endif
---


I don't understand the test on the TZ=UTC+0 timezone: I get tzname[0]="UTC" and 
tzname[1]="UTC" which fails the test...


In Python 2.7, there is:
---
/* This code moved from inittime wholesale to allow calling it from
time_tzset. In the future, some parts of it can be moved back
(for platforms that don't HAVE_WORKING_TZSET, when we know what they
are), and the extraneous calls to tzset(3) should be removed.
I haven't done this yet, as I don't want to change this code as
little as possible when introducing the time.tzset and time.tzsetwall
methods. This should simply be a method of doing the following once,
at the top of this function and removing the call to tzset() from
time_tzset():

#ifdef HAVE_TZSET
tzset()
#endif

And I'm lazy and hate C so nyer.
 */

#if defined(HAVE_TZNAME) && !defined(__GLIBC__) && !defined(__CYGWIN__)
---

The glibc is explicitly excluded from platforms which support "tzname". The 
"!defined(__GLIBC__)" test is quite old...

commit ea424e19f152638260c91d5fd6a805a288c931d2
Author: Guido van Rossum 
Date:   Fri Apr 23 20:59:05 1999 +

Apparently __GNU_LIBRARY__ is defined for glibc as well as for libc5.
The test really wanted to distinguish between the two.  So now we test
for __GLIBC__ instead.  I have confirmed that this works for glibc and
I have an email from Christian Tanzer confirming that it works for
libc5, so it should be fine.

--
components: Library (Lib)
messages: 330932
nosy: vstinner
priority: normal
severity: normal
status: open
title: time module: why not using tzname from the glibc?
versions: Python 3.8

___
Python tracker 

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



[issue35385] time module: why not using tzname from the glibc?

2018-12-03 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +belopolsky

___
Python tracker 

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



[issue35385] time module: why not using tzname from the glibc?

2018-12-03 Thread STINNER Victor


STINNER Victor  added the comment:

Ah, context of this question: I modified get_gmtoff() in bpo-35373 to fix 
compiler warnings :-) (see my first commit 
503ce5c482cb267b0770bc46c315d5cf822bdca9)

--

___
Python tracker 

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



[issue35373] PyInit_timezone() must return a value

2018-12-03 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset ab6614969301b238fcc27f43923a0189a57a2a3c by Victor Stinner in 
branch 'master':
bpo-35373: Fix PyInit_timezone() if HAVE_DECL_TZNAME is defined (GH-10861)
https://github.com/python/cpython/commit/ab6614969301b238fcc27f43923a0189a57a2a3c


--

___
Python tracker 

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



[issue35373] PyInit_timezone() must return a value

2018-12-03 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +10100

___
Python tracker 

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



[issue35373] PyInit_timezone() must return a value

2018-12-03 Thread STINNER Victor


STINNER Victor  added the comment:

Hum. By the way, PyInit_time() calls PyModule_AddObject() without checking for 
errors :-/

PyMODINIT_FUNC
PyInit_time(void)
{
PyObject *m;
m = PyModule_Create(&timemodule);
if (m == NULL)
return NULL;
...
PyModule_AddObject(m, "struct_time", (PyObject*) &StructTimeType);
...
return m;
}

It should have at least one final generic:

if (PyErr_Occurred()) {
return -1;
}

--

___
Python tracker 

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



[issue35373] PyInit_timezone() must return a value

2018-12-03 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +10101

___
Python tracker 

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



[issue35372] Code page decoder incorrectly handles input >2GiB

2018-12-03 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks for the fix ;-) I guess that nobody tried this code with a string longer 
than 2 GiB before you :-)

--

___
Python tracker 

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



[issue35368] [2.7] Make PyMem_Malloc() thread-safe in debug mode

2018-12-03 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset c275be54411d425c90e7c679ddb5321ba458f61d by Victor Stinner in 
branch '2.7':
bpo-35368: Make PyMem_Malloc() thread-safe in debug mode (GH-10828)
https://github.com/python/cpython/commit/c275be54411d425c90e7c679ddb5321ba458f61d


--

___
Python tracker 

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



[issue35377] urlsplit scheme argument broken

2018-12-03 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

You haven't given a convincing reason that there is a problem that needs 
fixing, or if there is, that your patch is the right way to fix it.

You have already pointed out that there is at least one scheme where :/// is 
part of a valid URL: "file:///". Where there is one, there could be others, if 
not today, then in the future:

spam:///eggs.cheese

There are well over 200 registered schemes:

https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml

I don't think it will be practical to put in a whitelist or a blacklist of 
schemes that are, or aren't, permitted to include :/// after the scheme. It is 
the caller's responsibility to use the correct scheme, without adding extra 
characters to the end.

I asked you to justify why this should be considered a bug in the library, 
rather than a bug in your code. I'm not an expert on URLs, but the functions 
look correct to me. If you can't justify why this is a bug in the library that 
needs fixing, rather than user-error, we should close this or change it to a 
request for better documentation.

--

___
Python tracker 

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



[issue35372] Code page decoder incorrectly handles input >2GiB

2018-12-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Decoding a 2 GiB string takes > 80 seconds on my computer and needs around 14 
GiB of memory.

--

___
Python tracker 

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



[issue35368] [2.7] Make PyMem_Malloc() thread-safe in debug mode

2018-12-03 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +10102

___
Python tracker 

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



[issue26868] Document PyModule_AddObject's behavior on error

2018-12-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

issue26868_v2.diff LGTM.

--

___
Python tracker 

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



[issue26868] Document PyModule_AddObject's behavior on error

2018-12-03 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
versions: +Python 3.8 -Python 3.5

___
Python tracker 

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



[issue35386] ftp://www.pythontest.net/ returns error 500

2018-12-03 Thread STINNER Victor

New submission from STINNER Victor :

The FTP server running at www.pythontest.net returns randomly errors with the 
code 500. Example:

$ lftp www.pythontest.net
lftp www.pythontest.net:~> ls
-r--r--r--1 33   33123 Jun 06 04:15 README
lftp www.pythontest.net:/> get README 
« README » à 0 (0%) [500 OOPS: vsf_sysutil_bind]


You can try in a brower: ftp://www.pythontest.net/README

Firefox popup: "500 OOPS: vsf_sysutil_bind".

--
components: Tests
messages: 330941
nosy: vstinner
priority: normal
severity: normal
status: open
title: ftp://www.pythontest.net/ returns error 500
versions: Python 3.8

___
Python tracker 

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



[issue35380] Enable TCP_NODELAY for proactor event loop

2018-12-03 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
keywords: +patch
pull_requests: +10103
stage:  -> patch review

___
Python tracker 

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



[issue35373] PyInit_timezone() must return a value

2018-12-03 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 3bb150d8148e3cc08418077a58f43e064b9fde61 by Victor Stinner in 
branch 'master':
bpo-35373: Fix PyInit_time() error handling (GH-10865)
https://github.com/python/cpython/commit/3bb150d8148e3cc08418077a58f43e064b9fde61


--

___
Python tracker 

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



[issue26544] platform.libc_ver() returns incorrect version number

2018-12-03 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +10104

___
Python tracker 

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



[issue35346] Modernize Lib/platform.py code

2018-12-03 Thread STINNER Victor


STINNER Victor  added the comment:

Another issue with Python 2 compatibility (I addition to platform.dist() 
removal) of Lib/platform.py from master: it uses re.ASCII which doesn't exist 
in Python 2.7.

--

___
Python tracker 

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



[issue35385] time module: why not using tzname from the glibc?

2018-12-03 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

See #28108 and https://sourceware.org/bugzilla/show_bug.cgi?id=23859 (for 
msg276123).

--
nosy: +izbyshev

___
Python tracker 

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



[issue35387] Dialogs on IDLE are accompanied by a small black window

2018-12-03 Thread Kevin Walzer


New submission from Kevin Walzer :

The "About IDLE" and "Preferences" dialogs on IDLE are accompanied by a small 
black window titled "idle" when IDLE is run agains the tip of Tk 8.6 on macOS 
10.14. This is likely owing to the multiple changes in Tk to accommodate the 
Mac's API changes on Mojave. I suspect the dialog's [wm transient] 
implementation is part of the issue; the parent windows for the dialog are not 
hidden when run against the Tk tip, and thus they have this ugly display. 
Hopefully the fix is not too complicated.

--
assignee: terry.reedy
components: IDLE
messages: 330945
nosy: terry.reedy, wordtech
priority: normal
severity: normal
status: open
title: Dialogs on IDLE are accompanied by a small black window
versions: Python 3.7

___
Python tracker 

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



[issue35351] LTOFLAGS are passed to BASECFLAGS when using LTO

2018-12-03 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +vstinner

___
Python tracker 

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



[issue35388] _PyRuntime_Initialize() called after Py_Finalize() does nothing

2018-12-03 Thread STINNER Victor


New submission from STINNER Victor :

When Python is embedded, it should be possible to call the following Python 
function multiple times:

void func(void)
{
  Py_Initialize();
  /* do something in Python */
  Py_Finalize();
}

Py_Finalize() ends by calling _PyRuntime_Finalize().

Problem: when Py_Initialize() is called the second time, 
_PyRuntime_Initialize() does nothing:

_PyInitError
_PyRuntime_Initialize(void)
{
/* XXX We only initialize once in the process, which aligns with
   the static initialization of the former globals now found in
   _PyRuntime.  However, _PyRuntime *should* be initialized with
   every Py_Initialize() call, but doing so breaks the runtime.
   This is because the runtime state is not properly finalized
   currently. */
static int initialized = 0;
if (initialized) {
return _Py_INIT_OK();
}
initialized = 1;

return _PyRuntimeState_Init(&_PyRuntime);
}

For example, Py_Finalize() clears runtime->interpreters.mutex and 
runtime->xidregistry.mutex, whereas mutexes are still needed the second time 
func() is called.

There is currently a *workaround*:

_PyInitError
_PyInterpreterState_Enable(_PyRuntimeState *runtime)
{
...
if (runtime->interpreters.mutex == NULL) {
...
runtime->interpreters.mutex = PyThread_allocate_lock();
...
}
...
}

I would prefer that _PyRuntime_Initialize() calls _PyRuntimeState_Init() each 
time, and that _PyRuntimeState_Init() does nothing at the following call 
(except after Py_Finalize?).

Note: _PyRuntimeState_Fini() doesn't free runtime->xidregistry.mutex currently.

--
messages: 330946
nosy: vstinner
priority: normal
severity: normal
status: open
title: _PyRuntime_Initialize() called after Py_Finalize() does nothing
versions: Python 3.8

___
Python tracker 

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



[issue31473] PyMem_Raw* API in debug mode are not thread safe

2018-12-03 Thread STINNER Victor


STINNER Victor  added the comment:

I looked at _Py_atomic_address to avoid atomic "serialno++", but we don't have 
atomic_fetch_add(). We could implement it using a loop and 
atomic_compare_exchange_strong()... but we don't have 
atomic_compare_exchange_strong() neither.

I tried to add a mutex, but there are some pratical issues:

* bpo-35388: question about calling Py_Initialize() / Py_Finalize() multiple 
times
* I modified _PyRuntimeState_Init() to initialize the lock.

_PyRuntimeState_Init() calls PyThread_acquire_lock() which calls 
PyMem_RawMalloc(). Problem: PyMem_RawMalloc() requires the lock. I worked 
around the isuse using "if (_PyRuntime.mem.mutex != NULL) {".

--

___
Python tracker 

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



[issue31473] PyMem_Raw* API in debug mode are not thread safe

2018-12-03 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-35265: "Internal C API: pass the memory allocator in a context".

The most complex part is the Python initialization which changes the memory 
allocator *and* allocate memory. We have to remain which allocator has been 
used to allocate data, to be able to release memory at exit.

--

___
Python tracker 

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



[issue31473] PyMem_Raw* API in debug mode are not thread safe

2018-12-03 Thread STINNER Victor


STINNER Victor  added the comment:

By the way, the previous attempt to add _PyRuntime.mem had to be reverted. See 
bpo-32096, bpo-30860 and the commit:

commit 9e87e7776f7ace66baaf7247233afdabd00c2b44
Author: Victor Stinner 
Date:   Fri Nov 24 12:09:24 2017 +0100

bpo-32096: Remove obj and mem from _PyRuntime (#4532)

bpo-32096, bpo-30860:  Partially revert the commit
2ebc5ce42a8a9e047e790aefbf9a94811569b2b6:

* Move structures back from Include/internal/mem.h to
  Objects/obmalloc.c
* Remove _PyObject_Initialize() and _PyMem_Initialize()
* Remove Include/internal/pymalloc.h
* Add test_capi.test_pre_initialization_api():
   Make sure that it's possible to call Py_DecodeLocale(), and then call
   Py_SetProgramName() with the decoded string, before Py_Initialize().

PyMem_RawMalloc() and Py_DecodeLocale() can be called again before
_PyRuntimeState_Init().

Co-Authored-By: Eric Snow 

--

___
Python tracker 

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



[issue35386] ftp://www.pythontest.net/ returns error 500

2018-12-03 Thread STINNER Victor


STINNER Victor  added the comment:

Ernest w. Durbin iii (EWDurbin) fixed the bug in less than one hour, cool! I 
contacted him on IRC (#python-infra).

The disk was full (/dev/vda1  25G  25G  0 100% /) and cron was stopped.

--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue26544] platform.libc_ver() returns incorrect version number

2018-12-03 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 8687bd86e6f138ef0699a1e9f3f9555765949b51 by Victor Stinner in 
branch '2.7':
bpo-26544: Make platform.libc_ver() less slow (GH-10868)
https://github.com/python/cpython/commit/8687bd86e6f138ef0699a1e9f3f9555765949b51


--

___
Python tracker 

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



[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2018-12-03 Thread Lars Beckers


Change by Lars Beckers :


--
nosy: +extmind

___
Python tracker 

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



[issue35389] Use gnu_get_libc_version() in platform.libc_ver()?

2018-12-03 Thread STINNER Victor


New submission from STINNER Victor :

Currently, platform.libc_ver() opens Python binary file (ex: /usr/bin/python3) 
and looks for a string like "GLIBC-2.28".

Maybe gnu_get_libc_version() should be exposed in Python to get the version of 
the running glibc version? And use it if available, or fall back on parsing the 
binary file (as done currenetly) otherwise.

Example:

$ cat x.c 
#include 
#include 
#include 

int
main(int argc, char *argv[])
{
printf("GNU libc version: %s\n", gnu_get_libc_version());
printf("GNU libc release: %s\n", gnu_get_libc_release());
exit(EXIT_SUCCESS);
}

$ ./x
GNU libc version: 2.28
GNU libc release: stable


I'm not sure if it's possible that Python is compiled with glibc but run with a 
different libc implementation?


--


Alternative: run a program to get the libc version which *might* be different 
than the libc version of Python if the libc is upgraded in the meanwhile 
(unlikely, but is technically possible on a server running for days):

$ ldd --version
ldd (GNU libc) 2.28
...

$ /lib64/libc.so.6 
GNU C Library (GNU libc) stable release version 2.28.
...

$ rpm -q glibc
glibc-2.28-17.fc29.x86_64
...

etc.


--


See also discussions on platform.libc_ver() performance:
https://github.com/python/cpython/pull/10868

--
components: Library (Lib)
messages: 330952
nosy: vstinner
priority: normal
severity: normal
status: open
title: Use gnu_get_libc_version() in platform.libc_ver()?
versions: Python 3.8

___
Python tracker 

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



[issue35389] Use gnu_get_libc_version() in platform.libc_ver()?

2018-12-03 Thread Jakub Wilk


Jakub Wilk  added the comment:

You can use confstr to get (running) glibc version:

>>> os.confstr('CS_GNU_LIBC_VERSION')
'glibc 2.28'

--
nosy: +jwilk

___
Python tracker 

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



[issue34172] multiprocessing.Pool and ThreadPool leak resources after being deleted

2018-12-03 Thread STINNER Victor


STINNER Victor  added the comment:

I suggest to revert this change, since it caused a regression: 
"multiprocessing.Pool.imap hangs in MacOs after applying this commit: (...)"

--
nosy: +benjamin.peterson, ned.deily, vstinner
priority: normal -> release blocker
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue10320] printf %qd is nonstandard

2018-12-03 Thread Mark Lawrence


Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue34172] multiprocessing.Pool and ThreadPool leak resources after being deleted

2018-12-03 Thread STINNER Victor


STINNER Victor  added the comment:

"""
def the_test():
print("Begin")
for x in multiprocessing.Pool().imap(int,
["4", "3"]):
print(x)
print("End")
"""

Side-note: Is it correct to use a pool without calling terminate() nor close()? 
Should we start to emit a ResourceWarning if a pool is not closed explicitly, 
as we did for files, sockets, asyncio event loops and subprocess.Popen objects?

--

___
Python tracker 

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



[issue35389] Use gnu_get_libc_version() in platform.libc_ver()?

2018-12-03 Thread STINNER Victor


STINNER Victor  added the comment:

> >>> os.confstr('CS_GNU_LIBC_VERSION')
> 'glibc 2.28'

That's cool because it doesn't require to write new C code ;-)

--

___
Python tracker 

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



[issue31473] PyMem_Raw* API in debug mode are not thread safe

2018-12-03 Thread STINNER Victor


STINNER Victor  added the comment:

Note: PTHREAD_MUTEX_INITIALIZER can be used to statically initialize a mutex.

--

___
Python tracker 

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



[issue31473] Debug hooks on memory allocators are not thread safe (serialno variable)

2018-12-03 Thread STINNER Victor


Change by STINNER Victor :


--
title: PyMem_Raw* API in debug mode are not thread safe -> Debug hooks on 
memory allocators are not thread safe (serialno variable)
versions: +Python 2.7, Python 3.8

___
Python tracker 

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



[issue31473] Debug hooks on memory allocators are not thread safe (serialno variable)

2018-12-03 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-35368: [2.7] Make PyMem_Malloc() thread-safe in debug mode.

--

___
Python tracker 

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



[issue35385] time module: why not using tzname from the glibc?

2018-12-03 Thread Paul Ganssle


Change by Paul Ganssle :


--
nosy: +p-ganssle

___
Python tracker 

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



[issue35368] [2.7] Make PyMem_Malloc() thread-safe in debug mode

2018-12-03 Thread STINNER Victor


STINNER Victor  added the comment:

According to bpo-31473, the debug hook on PyMem_Malloc() is not thread-safe: 
'serialno' variable is not protected by any lock and it's not atomic.

--

___
Python tracker 

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



[issue34172] multiprocessing.Pool and ThreadPool leak resources after being deleted

2018-12-03 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

Víctor, I have a PR fixing this in:

issue35378

Even if is not correct to not call close or join on the Pool, this behaviour 
was working before while now it hangs. The fix is really simple, si I think we 
should fix it and not revert the change on this case.

--

___
Python tracker 

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



[issue35390] ctypes not possible to pass NULL c_void_p in structure by reference

2018-12-03 Thread Dan


New submission from Dan :

I have a C struct 

typedef struct Effect {
void* ptr;
} Effect;

where when I allocate the memory, the void* gets initialized to NULL, and pass 
back a pointer:

Effect* get_effect(){
Effect* pEffect = malloc(sizeof(*pEffect));
pEffect->ptr = NULL;
return pEffect;
}

In Python, I need to call the C function to initialize, and then pass a 
REFERENCE to the pointer to another C function:

from ctypes import cdll, Structure, c_int, c_void_p, addressof, pointer, 
POINTER, c_double, byref
clibptr = cdll.LoadLibrary("libpointers.so")

class Effect(Structure):
_fields_ = [("ptr", POINTER(c_double))]

clibptr.get_effect.restype = POINTER(Effect)
pEffect = clibptr.get_effect()
effect = pEffect.contents
clibptr.print_ptraddress(byref(effect.ptr))

But this prints an error, because effect.ptr is None, so byref(None) fails.
Below is full working code in the case where ptr is instead a double*, where 
there is no problem. 
As far as I can tell, there is no way to pass a c_void_p field by reference, 
which would be very useful!

#include 
#include 

#define PRINT_MSG_2SX(ARG0, ARG1) printf("From C - [%s] (%d) - [%s]:  ARG0: 
[%s], ARG1: 0x%016llX\n", __FILE__, __LINE__, __FUNCTION__, ARG0, (unsigned 
long long)ARG1)

typedef struct Effect {
double* ptr;
} Effect;

void print_ptraddress(double** ptraddress){
PRINT_MSG_2SX("Address of Pointer:", ptraddress);
}

Effect* get_effect(){
Effect* pEffect = malloc(sizeof(*pEffect));
pEffect->ptr = NULL;
print_ptraddress(&pEffect->ptr);
return pEffect;
}

Python:

from ctypes import cdll, Structure, c_int, c_void_p, addressof, pointer, 
POINTER, c_double, byref
clibptr = cdll.LoadLibrary("libpointers.so")

class Effect(Structure):
_fields_ = [("ptr", POINTER(c_double))]

clibptr.get_effect.restype = POINTER(Effect)
pEffect = clibptr.get_effect()

effect = pEffect.contents
clibptr.print_ptraddress(byref(effect.ptr))

gives matching addresses:

>From C - [pointers.c] (11) - [print_ptraddress]: ARG0: [Address of Pointer:], 
>ARG1: 0x7FC2E1AD3770 From C - [pointers.c] (11) - [print_ptraddress]: 
>ARG0: [Address of Pointer:], ARG1: 0x7FC2E1AD3770

--
components: ctypes
messages: 330961
nosy: dtamayo
priority: normal
severity: normal
status: open
title: ctypes not possible to pass NULL c_void_p in structure by reference
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue34172] multiprocessing.Pool and ThreadPool leak resources after being deleted

2018-12-03 Thread tzickel


tzickel  added the comment:

The previous posts here touch all this subjects:
A. The documentation explicitly says: "When the pool object is garbage 
collected terminate() will be called immediately." (Happened till a code 
refactor 9 years ago introduced this bug).

B. Large amount of code was developed for this technique:
https://github.com/python/cpython/blob/master/Lib/multiprocessing/util.py#L147 
(Till the end of the file almost)

C. The reason I opened this bug was because I was called to see why a long 
running process crashes after a while, and found out it leaked tons of 
subprocesses / pool._cache memory.

D. The quoted code, will currently simply leak each invocation lots of 
subprocesses... 

I too, think we should push for the said fix.

--

___
Python tracker 

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



[issue9004] datetime.utctimetuple() should not set tm_isdst flag to 0

2018-12-03 Thread Natal Ngétal

Natal Ngétal  added the comment:

Please can you convert your patch to a pull request on github.

--
nosy: +hobbestigrou

___
Python tracker 

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



[issue35357] unittest.mock.call can't represent calls to a method called 'parent'

2018-12-03 Thread Andrew Dunai


Andrew Dunai  added the comment:

I've just stumbled upon this issue while looking for a good first issue to 
contribute on. If the community agrees this is something that needs to be done, 
I'll gladly work on this.

--
nosy: +and3rson

___
Python tracker 

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



[issue35357] unittest.mock.call can't represent calls to a method called 'parent'

2018-12-03 Thread Chris Withers


Chris Withers  added the comment:

Go for it! :-)

--

___
Python tracker 

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



[issue35357] unittest.mock.call can't represent calls to a method called 'parent'

2018-12-03 Thread Chris Withers


Chris Withers  added the comment:

Not sure I follow the second option, I was thinking of just _mock_parent and 
_mock_name when I logged this.

Happy to see a PR for either though!

--

___
Python tracker 

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



[issue35357] unittest.mock.call can't represent calls to a method called 'parent'

2018-12-03 Thread Andrew Dunai


Andrew Dunai  added the comment:

I see 2 most applicable ways to do it:

- Hide .parent and .name by mangling
- Define them within the mock class definition scope, but not within the class 
itself.

As long as those are accessed only from within the mock class, I think second 
method would be better as it would completely remove them from mock's 
attributes.

--

___
Python tracker 

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



[issue35267] reproducible deadlock with multiprocessing.Pool

2018-12-03 Thread dzhu


dzhu  added the comment:

Given the hairiness of the deadlock, I think I would rather let someone who has 
more experience with the codebase in general handle it, but I can come back to 
it if it doesn't get addressed.

--

___
Python tracker 

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



[issue9004] datetime.utctimetuple() should not set tm_isdst flag to 0

2018-12-03 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
pull_requests: +10105
stage: needs patch -> patch review

___
Python tracker 

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



[issue9004] datetime.utctimetuple() should not set tm_isdst flag to 0

2018-12-03 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:

I submitted Gaurav's patch as PR 10870.  Please review.

--

___
Python tracker 

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



[issue25567] shlex.quote doesn't work on bytestrings

2018-12-03 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +10106

___
Python tracker 

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



[issue35357] unittest.mock.call can't represent calls to a method called 'parent'

2018-12-03 Thread Andrew Dunai


Andrew Dunai  added the comment:

I was considering wrapping a `unittest.mock._Call` class definition within a 
function that would contain name & parent as local variables (arguments). Thus 
they would be accessible within the `_Call` class, but wouldn't be accessible 
from the outside. However this would make them inaccessible from other 
instances of `_Call`. So I think I'll stick to the more trivial solution of 
renaming them to `_mock_name` and `_mock_parent` to conform to the rest of the 
module :)

--

___
Python tracker 

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



[issue35391] threading.RLock exception handling while waiting

2018-12-03 Thread Omer Bartal


New submission from Omer Bartal :

(tested on python 2.7)

Created a threading.Condition(threading.RLock())
A piece of code acquires the lock using a with block and waits (for a notify)
While wait() is running a KeyboardInterrupt is raised
An exception is raised while exiting the lock's with block:
  File "/usr/lib/python2.7/threading.py", line 289, in __exit__
return self.__lock.__exit__(*args)
  File "/usr/lib/python2.7/threading.py", line 216, in __exit__
self.release()
  File "/usr/lib/python2.7/threading.py", line 204, in release
raise RuntimeError("cannot release un-acquired lock")

example code running on the main thread:
def waiting(lock): # (the lock was created using Condition(RLock()))
  with lock:
lock.wait(timeout=xxx) # while waiting a keyboard interrupt is raised

The issue is caused because threading.RLock doesn't handle the exception 
correctly:
def _acquire_restore(self, count_owner):
count, owner = count_owner
self.__block.acquire()
self.__count = count
self.__owner = owner
if __debug__:
self._note("%s._acquire_restore()", self)

The exception is raised after the acquire() returns and the count and owner are 
not restored.

The problem was solved using the following fix (added try, finally):
def _acquire_restore(self, count_owner):
count, owner = count_owner
try:
self.__block.acquire()
finally:
self.__count = count
self.__owner = owner
if __debug__:
self._note("%s._acquire_restore()", self)


Looking at the code, this issue exists in python 3.8 as well.

--
components: Library (Lib)
messages: 330972
nosy: Omer Bartal
priority: normal
severity: normal
status: open
title: threading.RLock exception handling while waiting
type: crash
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue35392] Create asyncio/sockutils.py

2018-12-03 Thread Andrew Svetlov


New submission from Andrew Svetlov :

As discussed with Yuri on 
https://github.com/python/cpython/pull/10867#discussion_r238395192

Candidate functions to move into the helper modules:
* _set_nodelay()
* _ipaddr_info()
* _set_reuseport()

--
components: asyncio
messages: 330973
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Create asyncio/sockutils.py
versions: Python 3.8

___
Python tracker 

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



[issue35380] Enable TCP_NODELAY for proactor event loop

2018-12-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10109

___
Python tracker 

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



[issue35380] Enable TCP_NODELAY for proactor event loop

2018-12-03 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset 3bc0ebab17bf5a2c29d2214743c82034f82e6573 by Andrew Svetlov in 
branch 'master':
bpo-35380: Enable TCP_NODELAY for proactor event loop (#10867)
https://github.com/python/cpython/commit/3bc0ebab17bf5a2c29d2214743c82034f82e6573


--

___
Python tracker 

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



[issue35357] unittest.mock.call can't represent calls to a method called 'parent'

2018-12-03 Thread Andrew Dunai


Change by Andrew Dunai :


--
keywords: +patch
pull_requests: +10110
stage:  -> patch review

___
Python tracker 

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



[issue35380] Enable TCP_NODELAY for proactor event loop

2018-12-03 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
pull_requests: +10111

___
Python tracker 

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



[issue9741] msgfmt.py generates invalid mo because msgfmt.make() does not clear dictionary

2018-12-03 Thread s-ball


Change by s-ball :


--
pull_requests: +10113
stage: test needed -> patch review

___
Python tracker 

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



[issue35335] msgfmt should be able to merge more than one po file

2018-12-03 Thread s-ball


Change by s-ball :


--
keywords: +patch
pull_requests: +10112
stage:  -> patch review

___
Python tracker 

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



[issue35393] Typo in documentation

2018-12-03 Thread Filip Bengtsson

New submission from Filip Bengtsson :

There are 256 characters in the range 0–255.

--
assignee: docs@python
components: Documentation
messages: 330975
nosy: autom, docs@python
priority: normal
pull_requests: 10114
severity: normal
status: open
title: Typo in documentation

___
Python tracker 

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



[issue35377] urlsplit scheme argument broken

2018-12-03 Thread devkral


devkral  added the comment:

ah, I get the idea behind urlunsplit. But still:
for e.g. http, http:/// is invalid. These urls are invalid for e.g. requests.
May I ask:
urllib.parse is for web protocol urls? If yes, then there should be an option 
which defaults to my version.

--

___
Python tracker 

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



[issue35335] msgfmt should be able to merge more than one po file

2018-12-03 Thread SilentGhost


Change by SilentGhost :


--
nosy: +eric.araujo, ezio.melotti

___
Python tracker 

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



[issue35335] msgfmt should be able to merge more than one po file

2018-12-03 Thread Éric Araujo

Éric Araujo  added the comment:

I am curious about the use cases for this feature!

--

___
Python tracker 

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



[issue35393] Typo in documentation

2018-12-03 Thread Eric V. Smith


Eric V. Smith  added the comment:

Can you be more specific? There's not enough information here to take any 
action.

--
nosy: +eric.smith

___
Python tracker 

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



[issue35335] msgfmt should be able to merge more than one po file

2018-12-03 Thread s-ball


s-ball  added the comment:

Currently my main use case is to be able to compile one or more po file(s) from 
a Python script, so I just need to be able to repeatedly call make from that 
script - which was broken per issue 9741

To be honest, I must acknowledge that I initially thought that compiling more 
than one po file was a common use case, and I only later realized that it was 
not. But as it was already (partially) allowed by msgfmt.py, I have just fixed 
the problems and added tests for it.

BTW, I am also the author of last commit, but I have written it on a box where 
I had forgotten to correctly initialize git

--

___
Python tracker 

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



  1   2   >