[issue29877] compileall hangs when accessing urandom even if number of workers is 1

2017-03-21 Thread Dustin Spicuzza

Changes by Dustin Spicuzza :


--
title: compileall fails with urandom error even if number of workers is 1 -> 
compileall hangs when accessing urandom even if number of workers is 1

___
Python tracker 

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



[issue29877] compileall fails with urandom error even if number of workers is 1

2017-03-21 Thread Dustin Spicuzza

New submission from Dustin Spicuzza:

Found on Python 3.6 on a low-resource platform (NI RoboRIO), it seems that this 
occurs only because the ProcessPoolExecutor is being imported. A proposed fix 
would only import ProcessPoolExecutor if -j > 1. Stacktrace follows:

 /usr/local/bin/python3 -m compileall -j 1 /home/lvuser/py
^CTraceback (most recent call last):
  File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
  File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
  File "/usr/local/lib/python3.6/compileall.py", line 20, in 
from concurrent.futures import ProcessPoolExecutor
  File "/usr/local/lib/python3.6/concurrent/futures/__init__.py", line 17, in 

from concurrent.futures.process import ProcessPoolExecutor
  File "/usr/local/lib/python3.6/concurrent/futures/process.py", line 53, in 

import multiprocessing
  File "/usr/local/lib/python3.6/multiprocessing/__init__.py", line 16, in 

from . import context
  File "/usr/local/lib/python3.6/multiprocessing/context.py", line 5, in 

from . import process
  File "/usr/local/lib/python3.6/multiprocessing/process.py", line 311, in 

_current_process = _MainProcess()
  File "/usr/local/lib/python3.6/multiprocessing/process.py", line 298, in 
__init__
self._config = {'authkey': AuthenticationString(os.urandom(32)),

--
components: Library (Lib)
messages: 289973
nosy: virtuald
priority: normal
severity: normal
status: open
title: compileall fails with urandom error even if number of workers is 1
versions: Python 3.6

___
Python tracker 

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



[issue29876] Check for null return value [_elementtree.c : subelement]

2017-03-21 Thread Alex CHEN

New submission from Alex CHEN:

In file _elementtree.c

our static code scanner has reported this case, I think there is a bit similar 
to http://bugs.python.org/issue29874 (returns NULL when NoMemory)

static PyObject*
subelement(PyObject* self, PyObject* args, PyObject* kw)
{
PyObject* elem;

ElementObject* parent;
PyObject* tag;
PyObject* attrib = NULL;
if (!PyArg_ParseTuple(args, "O!O|O!:SubElement",
  _Type, , ,
  _Type, ))
return NULL;

if (attrib || kw) {
attrib = (attrib) ? PyDict_Copy(attrib) : PyDict_New();
if (!attrib)
return NULL;
if (kw)
PyDict_Update(attrib, kw);
} else {
Py_INCREF(Py_None);
attrib = Py_None;
}

elem = element_new(tag, attrib);  // <== element_new could 
returns a NULL pointer, the followed Py_DECREF(elem) would dereference NULL 
pointer.

Py_DECREF(attrib);

if (element_add_subelement(parent, elem) < 0) {
Py_DECREF(elem);
return NULL;
}

--
components: XML
messages: 289972
nosy: alexc
priority: normal
severity: normal
status: open
title: Check for null return value [_elementtree.c : subelement]
type: crash
versions: Python 2.7

___
Python tracker 

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



[issue29868] multiprocessing.dummy missing cpu_count

2017-03-21 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +davin, flox

___
Python tracker 

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



[issue29875] IDLE quit unexpectedly

2017-03-21 Thread Ned Deily

Ned Deily added the comment:

Welcome to the world of Python! You most likely saw a message similar to this 
when the IDLE shell window opened:

WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable.
Visit http://www.python.org/download/mac/tcltk/ for current information.

If you follow that link, you'll see that you need to install a newer version of 
Tcl/Tk 8.5.x to avoid bugs in Tcl/Tk; the easiest solution is to download and 
install ActiveTcl 8.5 from ActiveState as described.

--
nosy: +ned.deily
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



[issue29875] IDLE quit unexpectedly

2017-03-21 Thread Igor

New submission from Igor:

Hi! I'm a newbie, both in this community and with Python. I downloaded Python 
today (March 22, 2017, version 3.6.1) and as I was following a tutorial on how 
to build my first program (the classical Hello World) with Python, the IDLE 
window closed and my Mac showed the following message: "IDLE quit 
unexpectedly". It happens every time I type the ' (single quotation mark).I've 
tried 10 times so far and it keeps happening. 
Thank you!

--
assignee: terry.reedy
components: IDLE
messages: 289970
nosy: igorafm, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE quit unexpectedly
versions: Python 3.6

___
Python tracker 

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



[issue29874] Need a look for return value checking [selectmodule.c]

2017-03-21 Thread Xiang Zhang

Changes by Xiang Zhang :


--
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



[issue29874] Need a look for return value checking [selectmodule.c]

2017-03-21 Thread Xiang Zhang

Changes by Xiang Zhang :


--
pull_requests: +672

___
Python tracker 

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



[issue29873] Need a look for return value checking [_elementtree.c]

2017-03-21 Thread Xiang Zhang

Xiang Zhang added the comment:

Fixed. Thanks for your report Alex.

--
nosy: +xiang.zhang
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



[issue29874] Need a look for return value checking [selectmodule.c]

2017-03-21 Thread Xiang Zhang

Xiang Zhang added the comment:

This has been fixed for 3.x in #18408 but not backported to 2.7.

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue29874] Need a look for return value checking [selectmodule.c]

2017-03-21 Thread Xiang Zhang

Changes by Xiang Zhang :


--
versions: +Python 2.7

___
Python tracker 

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



[issue29874] Need a look for return value checking [selectmodule.c]

2017-03-21 Thread Alex CHEN

Changes by Alex CHEN :


--
type:  -> crash

___
Python tracker 

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



[issue29874] Need a look for return value checking [selectmodule.c]

2017-03-21 Thread Alex CHEN

New submission from Alex CHEN:

In file selectmodule.c

our static code scanner has reported the following case, function set2list is 
liable to return NULL (if PyTuple_New failed),  would any chance the NULL 
pointer be dereferenced (Py_DECREF(fdlist) after set2list) or it would just 
raise python exception to handle PyTuple_New error ?

static PyObject *
select_select(PyObject *self, PyObject *args)
{
..
if (n < 0) {
PyErr_SetFromErrno(SelectError);
}
#endif
else {
/* any of these three calls can raise an exception.  it's more
   convenient to test for this after all three calls... but
   is that acceptable?
*/
ifdlist = set2list(, rfd2obj);  //   || <=
ofdlist = set2list(, wfd2obj);  //   ||
efdlist = set2list(, efd2obj);  //   ||
if (PyErr_Occurred())
ret = NULL;
else
ret = PyTuple_Pack(3, ifdlist, ofdlist, efdlist);

Py_DECREF(ifdlist);
Py_DECREF(ofdlist);
Py_DECREF(efdlist);

--
messages: 289967
nosy: alexc
priority: normal
severity: normal
status: open
title: Need a look for return value checking [selectmodule.c]

___
Python tracker 

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



[issue29873] Need a look for return value checking [_elementtree.c]

2017-03-21 Thread Xiang Zhang

Changes by Xiang Zhang :


--
pull_requests: +671

___
Python tracker 

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



[issue29871] Enable optimized locks on Windows

2017-03-21 Thread Josh Rosenberg

Josh Rosenberg added the comment:

Hmm... I was only running the threading related tests originally, and they 
passed, but it looks like this causes problems with multiprocessing 
(test_multiprocessing_spawn and test_concurrent_futures both stall out forever 
with this change, with or without my fix to the PyCOND_TIMEDWAIT function). 
I'll investigate further, don't bother to review yet.

--

___
Python tracker 

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



[issue29873] Need a look for return value checking [_elementtree.c]

2017-03-21 Thread Alex CHEN

New submission from Alex CHEN:

In file _elementtree.c

our static code scanner has reported this case, but I don't sure that could be 
any problem, may you have a look?

static PyObject*  
element_getattr(ElementObject* self, char* name)
{
PyObject* res;

/* handle common attributes first */
if (strcmp(name, "tag") == 0) {
res = self->tag;
Py_INCREF(res);
return res;
} else if (strcmp(name, "text") == 0) {
res = element_get_text(self); // is it possible that 
element_get_text could return NULL here?
Py_INCREF(res);
return res;
}

--
components: XML
messages: 289965
nosy: alexc
priority: normal
severity: normal
status: open
title: Need a look for return value checking [_elementtree.c]
type: crash
versions: Python 2.7

___
Python tracker 

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



[issue21895] signal.pause() and signal handlers don't react to SIGCHLD in non-main thread

2017-03-21 Thread Nathaniel Smith

Nathaniel Smith added the comment:

@haypo: okay, looked over things over for a third time and this time I found my 
very silly error :-). So I'm now able to use set_wakeup_fd on Windows 
(https://github.com/python-trio/trio/pull/108), but not on Unix 
(https://github.com/python-trio/trio/issues/109).

In any case, the issue here remains that one shouldn't have to use 
set_wakeup_fd for a signal to interrupt time.sleep etc.

--

___
Python tracker 

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



[RELEASE] Python 3.6.1 is now available

2017-03-21 Thread Ned Deily
On behalf of the Python development community and the Python 3.6 release
team, I would like to announce the availability of Python 3.6.1, the
first maintenance release of Python 3.6.  3.6.0 was released on 2016-12-22
to great interest and now, three months later, we are providing the
first set of bugfixes and documentation updates for it.  Although it
should be transparent to users of Python, 3.6.1 is the first release
after some major changes to our development process so we ask users
who build Python from source to be on the lookout for any unexpected
differences.

Please see "What’s New In Python 3.6" for more information:

https://docs.python.org/3.6/whatsnew/3.6.html

You can find Python 3.6.1 here:

https://www.python.org/downloads/release/python-361/

and its change log here:

https://docs.python.org/3.6/whatsnew/changelog.html#python-3-6-1

The next maintenance release of Python 3.6 is expected to follow in
about 3 months by the end of 2017-06.  More information about the 3.6
release schedule can be found here:

https://www.python.org/dev/peps/pep-0494/


--
  Ned Deily
  n...@python.org -- []

-- 
https://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


[issue29504] blake2: compile error with -march=bdver2

2017-03-21 Thread Ned Deily

Ned Deily added the comment:

This didn't make it in time for 3.6.1; deferred to 3.6.2.

--

___
Python tracker 

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



[RELEASE] Python 3.6.1 is now available

2017-03-21 Thread Ned Deily
On behalf of the Python development community and the Python 3.6 release
team, I would like to announce the availability of Python 3.6.1, the
first maintenance release of Python 3.6.  3.6.0 was released on 2016-12-22
to great interest and now, three months later, we are providing the
first set of bugfixes and documentation updates for it.  Although it
should be transparent to users of Python, 3.6.1 is the first release
after some major changes to our development process so we ask users
who build Python from source to be on the lookout for any unexpected
differences.

Please see "What’s New In Python 3.6" for more information:

https://docs.python.org/3.6/whatsnew/3.6.html

You can find Python 3.6.1 here:

https://www.python.org/downloads/release/python-361/

and its change log here:

https://docs.python.org/3.6/whatsnew/changelog.html#python-3-6-1

The next maintenance release of Python 3.6 is expected to follow in
about 3 months by the end of 2017-06.  More information about the 3.6
release schedule can be found here:

https://www.python.org/dev/peps/pep-0494/


--
  Ned Deily
  n...@python.org -- []

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29872] spam

2017-03-21 Thread Xiang Zhang

Changes by Xiang Zhang :


--
Removed message: http://bugs.python.org/msg289962

___
Python tracker 

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



[issue29872] spam

2017-03-21 Thread Xiang Zhang

Changes by Xiang Zhang :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
title: My reply -> spam

___
Python tracker 

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



[issue29872] My reply

2017-03-21 Thread James Triveri

New submission from James Triveri:

reply from james.triv...@gmail.com

--
messages: 289962
nosy: jtrive84
priority: normal
severity: normal
status: open
title: My reply

___
Python tracker 

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



[issue29870] ssl socket leak

2017-03-21 Thread Alexander Mohr

Alexander Mohr added the comment:

interestingly the valgrind run doesn't show a leak in the profile

--

___
Python tracker 

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



[issue29870] ssl socket leak

2017-03-21 Thread Alexander Mohr

Alexander Mohr added the comment:

adding valgrind log of 3.5.3 on debian: jessie

--
Added file: http://bugs.python.org/file46750/valgrind.log.gz

___
Python tracker 

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



[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-03-21 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
stage:  -> patch review
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



[issue28767] Readd __index__ support on ipaddress objects

2017-03-21 Thread Josh Rosenberg

Josh Rosenberg added the comment:

>From the original bugs, it looks like people liked being able to directly 
>produce the hex of the IP addresses using hex(). I'll admit I'm only +0.5 on 
>restoring __index__; having them be equivalent to int, not just convertable, 
>doesn't seem critical. I just noticed the original bugs (don't even remember 
>why I found them) and figured the functionality should be restored, per the 
>comments on those bugs.

--

___
Python tracker 

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



[issue29871] Enable optimized locks on Windows

2017-03-21 Thread Josh Rosenberg

Josh Rosenberg added the comment:

Note: Beyond turning on the new primitives by default, I also made a change to 
PyCOND_TIMEDWAIT. The original code looked wrong, in that:

1. It assumed that when SleepConditionVariableSRW returned non-zero, you didn't 
know if the wait had timed out or not, so it returned 2 to indicate "Might have 
timed out, act as if it timed out"
2. It assumed that when SleepConditionVariableSRW returned zero, it had 
suffered a critical failure, and returned -1 to indicate that.

Neither of these things is true AFAICT. SleepConditionVariableSRW returns 
non-zero when it's alerted prior to timing out. Otherwise, it returns 0, and 
you have to check GetLastError to distinguish timeout from critical failures. 
Documentation is here: 
https://msdn.microsoft.com/en-us/library/windows/desktop/ms686304(v=vs.85).aspx

It's subject to "spurious" wake-ups, but so is pthread_cond_timedwait and the 
pthreads code doesn't use an "all timedwaits time out".

--

___
Python tracker 

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



[issue29871] Enable optimized locks on Windows

2017-03-21 Thread Josh Rosenberg

Changes by Josh Rosenberg :


--
pull_requests: +670

___
Python tracker 

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



[issue21895] signal.pause() and signal handlers don't react to SIGCHLD in non-main thread

2017-03-21 Thread Nathaniel Smith

Nathaniel Smith added the comment:

@haypo: It's a socketpair. It works fine when I set up a toy test case using 
set_wakeup_fd + select, and it works fine in my real code when I use CFFI 
cleverness to register a signal handler that manually writes a byte to my 
wakeup socket, but when I pass that exact same socket to set_wakeup_fd in my 
real code, it doesn't work. It's pretty mysterious, and I have no particular 
reason to think that the problem is in CPython as opposed to some stupid 
mistake I'm making.

--

___
Python tracker 

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



[issue29870] ssl socket leak

2017-03-21 Thread Alexander Mohr

Alexander Mohr added the comment:

validated 3.6 in fedora is affected as well, see github bug for charts.  So it 
seems all 3.5.3+ versions are affected.  I'm guessing it was introduced in one 
of the SSL changes in 3.5.3: 
https://docs.python.org/3.5/whatsnew/changelog.html#python-3-5-3

--
versions: +Python 3.6

___
Python tracker 

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



[issue29871] Enable optimized locks on Windows

2017-03-21 Thread Josh Rosenberg

New submission from Josh Rosenberg:

Kristjan wrote improved locking primitives in #15038 that use the new (in 
Vista) SRWLock and Condition Variable APIs. SRWLocks (used in exclusive mode 
only) replace Critical Sections, which is slower than SRWLock and provides no 
features we use that might justify it. Condition Variables replace Semaphores, 
where the former is user mode (cheap) and the latter kernel mode (expensive).

These changes remain disabled by default.

Given that CPython dropped support for pre-Vista OSes in 3.5, I propose 
enabling the faster locking primitives by default. The PR I'll submit leaves 
the condition variable emulation code in the source so it's available to people 
who might try to build XP/WS03 compatible code, it just tweaks the define so it 
defaults to using the Vista+ APIs.

Based on the numbers from #15038, we should expect to see a significant 
improvement in speed.

--
components: Interpreter Core, Windows
messages: 289955
nosy: josh.r, kristjan.jonsson, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Enable optimized locks on Windows
type: performance
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



Re: Who are the "spacists"?

2017-03-21 Thread Ben Finney
Grant Edwards  writes:

> Question: is it still successfull trolling if we all knew that was the
> intent and are just playing along for the entertainment value?

Yes, it creates more noise and drives away signal from people who don't
want to be in a noisy environment. That is success for the troll.

-- 
 \ “Pinky, are you pondering what I'm pondering?” “I think so, |
  `\  Brain, but isn't that why they invented tube socks?” —_Pinky |
_o__)   and The Brain_ |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Who are the "spacists"?

2017-03-21 Thread Mikhail V
On 21 March 2017 at 16:42, Michael Torrie  wrote:
> On 03/21/2017 08:15 AM, Mikhail V wrote:
>> Didn't want to say this, but you know it was quite predictable from
>> the beginning that
>> the arguments will end up somewhere in "linux console is the center of the
>> universe, e-macs is mother of all apps and monospaced text is peak of
>> human evolution".
>
> Knowing that, the honest question is: if you knew where this would all
> end up (in a heated argument), why did post your provocation in the
> first place?

That was a metaphor, it was predictable that arguments
will touch some retro aspects, but it was quite unpredictable
that till now I did not see good arguments for spaces, and
I was interested of course to see some technical aspects.

So one of mentioned points for spaces which I can count as
more or less real argument, that many web forms keep
converting tabs to spaces, when I paste code into them
and when I copy back into the editor, I need again to
convert them. This is not a good argument against
tabs but this is at least a *real* issue. Unlike other,
(not so logical or yet not supported) arguments.

Does it sound reasonable?
Why I ask? Well obviously because I and probably
many people want to know why cannot one make
sort of styleguide based on pros and cons.


Mikhail
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29870] ssl socket leak

2017-03-21 Thread Alexander Mohr

New submission from Alexander Mohr:

When upgrading to 3.5.3 we noticed that the requests module was leaking memory 
rather quickly.  This led to me logging the issue: 
https://github.com/kennethreitz/requests/issues/3933.  After more investigation 
I've found that the leak is caused by the raw python SSL sockets.  I've created 
a test file here: 
https://gist.github.com/thehesiod/ef79dd77e2df7a0a7893dfea6325d30a which allows 
you to reproduce the leak with raw python ssl socket (CLIENT_TYPE = 
ClientType.RAW), aiohttp or requests.  They all leak in a similar way due to 
their use of the python SSL socket objects.  I tried tracing the memory usage 
with tracemalloc but nothing interesting popped up so I believe this is a leak 
in the native code.

A docker cloud image is available here: amohr/testing:stretch_request_leak 
based on:
```
FROM debian:stretch

COPY request_https_leak.py /tmp/request_https_leak.py

RUN apt-get update && \
apt-get install -y python3.5 python3-pip git

RUN python3 -m pip install requests 
git+git://github.com/thehesiod/pyca.git@fix-py3#egg=calib setproctitle requests 
psutil
```

I believe this issue was introduced in python 3.5.3 as we're not seeing the 
leak with 3.5.2.  Also I haven't verified yet if this happens on non-debian 
systems.  I'll update if I have any more info.  I believe 3.6 is similarly 
impacted but am not 100% certain yet.

--
assignee: christian.heimes
components: SSL
messages: 289954
nosy: christian.heimes, thehesiod
priority: normal
severity: normal
status: open
title: ssl socket leak
type: resource usage
versions: Python 3.5

___
Python tracker 

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



[issue21895] signal.pause() and signal handlers don't react to SIGCHLD in non-main thread

2017-03-21 Thread STINNER Victor

STINNER Victor added the comment:

2017-03-22 1:55 GMT+01:00 Nathaniel Smith :
> + for some reason set_wakeup_fd doesn't work for me on Windows (no idea why, 
> can't reproduce in simplified tests, might be my fault, need to debug),

I modified signal.set_wakeup_fd() to accept a socket handle on
Windows. Are you using socket.socketpair() on Windows? Or do you pass
a pipe?

--

___
Python tracker 

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



[issue21895] signal.pause() and signal handlers don't react to SIGCHLD in non-main thread

2017-03-21 Thread Nathaniel Smith

Nathaniel Smith added the comment:

I don't really have a specific use case personally -- for trio, I haven't found 
a way to make use of set_wakeup_fd because of various issues[1], but I'm also 
not planning to use SIGCHLD, so this isn't very urgent.

In general set_wakeup_fd can be a workaround, but I wanted to note this 
upstream because it's a bug in Python's signal handler logic. Note that Python 
already goes to great lengths to make e.g. signal handlers run during 
time.sleep on Windows; they ought to just work on Unix too.

--

[1] (Off-topic but in case you're curious: I register actual signal handlers 
anyway because I follow the philosophy that the wakeup pipe should only be used 
for wakeups rather than transmitting information, so as long as signal handlers 
work I can do my own wakeups, + for some reason set_wakeup_fd doesn't work for 
me on Windows (no idea why, can't reproduce in simplified tests, might be my 
fault, need to debug), + set_wakeup_fd's handling of buffer overflow is broken 
for my purposes.)

--

___
Python tracker 

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



[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-03-21 Thread Nevada Sanchez

Changes by Nevada Sanchez :


--
pull_requests: +668

___
Python tracker 

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



[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-03-21 Thread Nevada Sanchez

New submission from Nevada Sanchez:

The following should work in Python 3.6

```
from lib2to3.pgen2 import driver
from lib2to3 import pytree
from lib2to3 import pygram

_GRAMMAR_FOR_PY3 = pygram.python_grammar_no_print_statement.copy()
parser_driver = driver.Driver(_GRAMMAR_FOR_PY3, convert=pytree.convert)
tree = parser_driver.parse_string('100_1\n', debug=False)
```

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 289951
nosy: nevsan
priority: normal
severity: normal
status: open
title: Underscores in numeric literals not supported in lib2to3.
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue29868] multiprocessing.dummy missing cpu_count

2017-03-21 Thread John Wiseman

New submission from John Wiseman:

The documentation for the multiprocessing.dummy module says that it "replicates 
the API of multiprocessing."  In Python 2.7, I can import multiprocessing.dummy 
and use the cpu_count function:

$ python2
Python 2.7.12 (default, Oct 29 2016, 19:21:06)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import multiprocessing.dummy as mp
>>> mp.cpu_count()
8

But in Python 3.6, multiprocessing.dummy is missing cpu_count:

$ python3
Python 3.6.0 (default, Mar 21 2017, 13:27:21)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import multiprocessing.dummy as mp
>>> mp.cpu_count()
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: module 'multiprocessing.dummy' has no attribute 'cpu_count'

I would expect that multiprocessing.dummy would have cpu_count, since that 
function is available in multiprocessing, and it's there in Python 2.7.

It looks like it was removed in commit 04842a8, "Remove unused or redundant 
imports in concurrent.futures and multiprocessing" (Florent Xicluna 5 years 
ago).  Maybe the removal was inadvertent?

I realize there are several workarounds, but based on the documentation and the 
behavior of previous versions, I wouldn't have expected this breaking change.

--
components: Library (Lib)
messages: 289950
nosy: johnwiseman
priority: normal
severity: normal
status: open
type: behavior
versions: Python 3.6

___
Python tracker 

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



Re: Who are the "spacists"?

2017-03-21 Thread Mikhail V
On 21 March 2017 at 22:40, Chris Angelico  wrote:
> On Wed, Mar 22, 2017 at 8:27 AM, Mikhail V  wrote:
>> I'd just tell one thing since I am a bit tired: if you wish,
>> take an advice: avoid *any* monospaced fonts as plague if you are
>> reading a lot of information, this includes coding.
>> Avoid *any* sepia color schemes as plague.
>> Avoid *any* sans-serif font. Get the most close
>> to Garamond or Perpetua font.
>>
>> For cases, where you *absolutely must* use monospaced
>> font, stick to Courier font (it is called "Courier 10 pitch" on Linux, if
>> you don't have it in the system, try to find it, it must be
>> in some true type font package).
>> As for editing executables I don't know what *exactly*
>> are you trying to do, what processes are involved,
>> so I can't advice much.
>> And don't worry if a zero does not look like a pusy,
>> but looks like a big O, this is irrelevant in most cases.
>>
>> Now if you follow this, then probably in some time you
>> will say: thanks, good man Mikhail.
>
> Thanks, good troll Mikhail. You started a nice thread, but your advice
> is now crystal clear for what it is: duff.
>

Youre welcome, good troll Chris  :)
And in this thread (apart this comment) you were reasonable, I am pleased.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Who are the "spacists"?

2017-03-21 Thread Chris Angelico
On Wed, Mar 22, 2017 at 8:27 AM, Mikhail V  wrote:
> I'd just tell one thing since I am a bit tired: if you wish,
> take an advice: avoid *any* monospaced fonts as plague if you are
> reading a lot of information, this includes coding.
> Avoid *any* sepia color schemes as plague.
> Avoid *any* sans-serif font. Get the most close
> to Garamond or Perpetua font.
>
> For cases, where you *absolutely must* use monospaced
> font, stick to Courier font (it is called "Courier 10 pitch" on Linux, if
> you don't have it in the system, try to find it, it must be
> in some true type font package).
> As for editing executables I don't know what *exactly*
> are you trying to do, what processes are involved,
> so I can't advice much.
> And don't worry if a zero does not look like a pusy,
> but looks like a big O, this is irrelevant in most cases.
>
> Now if you follow this, then probably in some time you
> will say: thanks, good man Mikhail.

Thanks, good troll Mikhail. You started a nice thread, but your advice
is now crystal clear for what it is: duff.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Who are the "spacists"?

2017-03-21 Thread Mikhail V
On 21 March 2017 at 17:41, Gene Heskett  wrote:
> On Tuesday 21 March 2017 11:04:58 Mikhail V wrote:
>
>> On 21 March 2017 at 15:49, Grant Edwards 
> wrote:
>> > On 2017-03-21, Mikhail V  wrote:
>> >
>> >> I don't know how to help, probably if there is an important
>> >> document which you want different people to read, just make plain
>> >> txt, or HTML table, Office document, PNG image, etc.  Or just use
>> >> spaces if it is for ASCII-art purposes.
>> >
>> > Well written code _is_ ASCII-art.
>>
>> Written code is ASCII-art only if you live in the Monospaced Kingdom,

>
> Whats wrong with Monospace (caps yours)? In case you've not heard the
> news, we (linux users, other platform unk, don't use them) have a font,
> called "hack" (announced several years ago) that is not only Monospaced
> but quite civilized to look at. I use it for editing any executable
> codes source language, and here in kmail too.
>

This was already discussed here what is wrong with monospaced,
but ok, since you question. Look, I know what is Hack font as
well a lot of other thing about fonts, since I work on fonts
and reading-related problems my whole life.
I'd just tell one thing since I am a bit tired: if you wish,
take an advice: avoid *any* monospaced fonts as plague if you are
reading a lot of information, this includes coding.
Avoid *any* sepia color schemes as plague.
Avoid *any* sans-serif font. Get the most close
to Garamond or Perpetua font.

For cases, where you *absolutely must* use monospaced
font, stick to Courier font (it is called "Courier 10 pitch" on Linux, if
you don't have it in the system, try to find it, it must be
in some true type font package).
As for editing executables I don't know what *exactly*
are you trying to do, what processes are involved,
so I can't advice much.
And don't worry if a zero does not look like a pusy,
but looks like a big O, this is irrelevant in most cases.

Now if you follow this, then probably in some time you
will say: thanks, good man Mikhail.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python.NET question?

2017-03-21 Thread MRAB

On 2017-03-21 07:27, Tristan B. Kildaire wrote:

Is Python.NET a version of Python that compiles Python source code to
Microsoft's IR for running by a MS runtime?


Is this what you're talking about?

https://github.com/pythonnet/pythonnet

It says """Python for .NET is a package that gives Python programmers 
nearly seamless integration with the .NET Common Language Runtime (CLR) 
and provides a powerful application scripting tool for .NET developers."""


--
https://mail.python.org/mailman/listinfo/python-list


[issue24796] Deleting names referencing from enclosed and enclosing scopes

2017-03-21 Thread Ivan Levkivskyi

Changes by Ivan Levkivskyi :


--
pull_requests: +667

___
Python tracker 

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



Re: PyPy2.7 and PyPy3.5 v5.7 - two in one release

2017-03-21 Thread Robert O'Shea
Been meaning to give Pypy a try for a while, tonight may be the time

On Tue 21 Mar 2017, 20:32 ,  wrote:

> Hopefully this
> https://morepypy.blogspot.co.uk/2017/03/pypy27-and-pypy35-v57-two-in-one-release.html
> is rather more interesting for some than blatant trolling about spaces vs
> tabs.
>
> Kindest regards.
>
> Mark Lawrence.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


PyPy2.7 and PyPy3.5 v5.7 - two in one release

2017-03-21 Thread breamoreboy
Hopefully this 
https://morepypy.blogspot.co.uk/2017/03/pypy27-and-pypy35-v57-two-in-one-release.html
 is rather more interesting for some than blatant trolling about spaces vs tabs.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29866] Added datetime_diff to datetime.py.

2017-03-21 Thread Decorater

Decorater added the comment:

I plan to also have it to where if it is the last unit in the thing that it 
appends an and to the end as well.

--

___
Python tracker 

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



[issue29866] Added datetime_diff to datetime.py.

2017-03-21 Thread Decorater

Decorater added the comment:

Alright I revised it a bit locally too

>>> import datetime
>>> datetime.datetime_diff(datetime.datetime(2017, 1, 31), 
>>> datetime.datetime(2017, 1, 31))
''
>>> datetime.datetime_diff(datetime.datetime(2016, 12, 31, 23, 59, 59), 
>>> datetime.datetime(2017, 1, 1))
'1 year ago.'
>>> datetime.datetime_diff(datetime.datetime(2016, 1, 31), 
>>> datetime.datetime(2017, 1, 31, 1))
'1 year, 1 hour ago.'
>>>

--

___
Python tracker 

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



Re: __del__ is not called after creating a new reference

2017-03-21 Thread Oleg Nesterov
On 03/21, Steve D'Aprano wrote:
>
> I changed the code to run:
>
> c = C()
> del c
>
> and now I'm seeing the same thing as you: DEL is only printed once.

Yes, I've forwared this question to python-dev, please see
https://mail.python.org/pipermail/python-dev/2017-March/147631.html

so the implementation is fine, the docs should be probably updated.

Oleg.

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29866] Added datetime_diff to datetime.py.

2017-03-21 Thread Decorater

Decorater added the comment:

Oh, I just realized I forgot to add other if's to each block in case certain 
parts was 0 but others was not. I also realized I tried to do 
datetime.datetime.new instead of datetime.datetime.now on the tests.

--

___
Python tracker 

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



Re: Exporting Tensorflow inceptionv3 graph for weight and bias extraction

2017-03-21 Thread jladasky
On Tuesday, March 21, 2017 at 6:27:43 AM UTC-7, Zizwan wrote:
> Anyone can help me with this?

TensorFlow has a Python wrapper, but it isn't Python.  

Do you require Python for what you are trying to do?  You might try looking for 
more information in the TensorFlow tutorial newsgroup:

https://groups.google.com/forum/#!forum/tensorflow

I'm just getting started with TF myself, so I'm sorry that I can't answer your 
question.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29859] Return code of pthread_* in thread_pthread.h is not used for perror

2017-03-21 Thread INADA Naoki

Changes by INADA Naoki :


--
pull_requests: +666

___
Python tracker 

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



[issue29847] Path takes and ignores **kwargs

2017-03-21 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> The support of **kwargs in Path.__new__ is needed if you want to implement a 
> subclass of Path with __init__ accepting keyword arguments

I don't remember exactly, but I think this was the intention indeed.  There was 
originally an openat-using subclass, and IIRC it took additional parameters 
(such as the directory fd). That got scrapped quite early in the process, so we 
can remove the **kwargs thing now.

--

___
Python tracker 

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



[issue29847] Path takes and ignores **kwargs

2017-03-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I don't know whether it was the intension of Antoine or just an oversight. I 
don't know whether it is used in the wild. But we can at least raise a 
TypeError for concrete classes PosixPath and WindowsPath if ignoring keyword 
arguments is a problem. Many extension types don't take keyword arguments, but 
their subclasses accept and ignore keyword arguments. For example:

>>> filter(None, [], foo=123)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: filter() does not take keyword arguments
>>> class X(filter): pass
... 
>>> X(None, [], foo=123)
<__main__.X object at 0xb6fdcacc>

--

___
Python tracker 

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



[issue29847] Path takes and ignores **kwargs

2017-03-21 Thread Brett Cannon

Brett Cannon added the comment:

Shoot, that's too bad. I guess we should document it then so people are aware 
that keyword arguments are ignored, else we will break subclasses. There's also 
an unfortunate difference between PurePath and Path as PurePath doesn't have 
this quirk.

--

___
Python tracker 

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



[issue29862] Fix grammar typo in importlib.reload() exception

2017-03-21 Thread Brett Cannon

Changes by Brett Cannon :


--
title: Fix grammar in importlib.reload() exception -> Fix grammar typo in 
importlib.reload() exception

___
Python tracker 

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



Re: Who are the "spacists"?

2017-03-21 Thread Gene Heskett
On Tuesday 21 March 2017 11:04:58 Mikhail V wrote:

> On 21 March 2017 at 15:49, Grant Edwards  
wrote:
> > On 2017-03-21, Mikhail V  wrote:
> >> Didn't want to say this, but you know it was quite predictable from
> >> the beginning that the arguments will end up somewhere in "linux
> >> console is the center of the universe, e-macs is mother of all apps
> >> and monospaced text is peak of human evolution".
> >
> > Well, I'm glad you've finally admitted it. :)
> >
> >> I don't know how to help, probably if there is an important
> >> document which you want different people to read, just make plain
> >> txt, or HTML table, Office document, PNG image, etc.  Or just use
> >> spaces if it is for ASCII-art purposes.
> >
> > Well written code _is_ ASCII-art.
>
> Written code is ASCII-art only if you live in the Monospaced Kingdom,

Whats wrong with Monospace (caps yours)? In case you've not heard the 
news, we (linux users, other platform unk, don't use them) have a font, 
called "hack" (announced several years ago) that is not only Monospaced 
but quite civilized to look at. I use it for editing any executable 
codes source language, and here in kmail too.

> and even there, only if you draw ASCII-art in multi-line comment
> blocks. But its true, that it will have a notable place in a museum.
>
> Mikhail


Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page 
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27593] Deprecate sys._mercurial and create sys._git

2017-03-21 Thread Brett Cannon

Brett Cannon added the comment:

The output LGTM.

--

___
Python tracker 

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



Re: Who are the "spacists"?

2017-03-21 Thread Grant Edwards
On 2017-03-21, Jon Ribbens  wrote:
> On 2017-03-21, Michael Torrie  wrote:
>> On 03/21/2017 08:15 AM, Mikhail V wrote:
>>> Didn't want to say this, but you know it was quite predictable from
>>> the beginning that the arguments will end up somewhere in "linux
>>> console is the center of the universe, e-macs is mother of all apps
>>> and monospaced text is peak of human evolution".
>>
>> Knowing that, the honest question is: if you knew where this would all
>> end up (in a heated argument), why did post your provocation in the
>> first place?
>
> Seriously, could the trolling be any more obvious? Or successful?

Question: is it still successfull trolling if we all knew that was the
intent and are just playing along for the entertainment value?

-- 
Grant Edwards   grant.b.edwardsYow! Well, O.K.
  at   I'll compromise with my
  gmail.comprinciples because of
   EXISTENTIAL DESPAIR!

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Who are the "spacists"?

2017-03-21 Thread Jon Ribbens
On 2017-03-21, Michael Torrie  wrote:
> On 03/21/2017 08:15 AM, Mikhail V wrote:
>> Didn't want to say this, but you know it was quite predictable from
>> the beginning that the arguments will end up somewhere in "linux
>> console is the center of the universe, e-macs is mother of all apps
>> and monospaced text is peak of human evolution".
>
> Knowing that, the honest question is: if you knew where this would all
> end up (in a heated argument), why did post your provocation in the
> first place?

Seriously, could the trolling be any more obvious? Or successful?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29863] Add a COMPACT constant to the json module

2017-03-21 Thread Bob Ippolito

Bob Ippolito added the comment:

I suppose I'm +0. I don't think this is particularly useful, but this is closer 
to the ideal of just having a boolean option. We should probably also plan to 
remove the documentation for what the type of separators is to give the 
impression that COMPACT and the default are the only valid options.

--

___
Python tracker 

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



Re: Who are the "spacists"?

2017-03-21 Thread Rhodri James

On 21/03/17 15:04, Mikhail V wrote:

On 21 March 2017 at 15:49, Grant Edwards  wrote:

On 2017-03-21, Mikhail V  wrote:


Didn't want to say this, but you know it was quite predictable from
the beginning that the arguments will end up somewhere in "linux
console is the center of the universe, e-macs is mother of all apps
and monospaced text is peak of human evolution".


Well, I'm glad you've finally admitted it. :)


I don't know how to help, probably if there is an important document
which you want different people to read, just make plain txt, or
HTML table, Office document, PNG image, etc.  Or just use spaces if
it is for ASCII-art purposes.


Well written code _is_ ASCII-art.


Written code is ASCII-art only if you live in the Monospaced Kingdom,
and even there, only if you draw ASCII-art in multi-line comment blocks.
But its true, that it will have a notable place in a museum.


You misunderstand; well-written code has a pleasing shape all of its 
own, never mind any deliberate attempts at diagramming.  You may be 
correct that it is only true in the Monospaced Kingdom; if so, that's a 
major plus point for fixed-width fonts.


--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list


Re: Who are the "spacists"?

2017-03-21 Thread Michael Torrie
On 03/21/2017 08:15 AM, Mikhail V wrote:
> Didn't want to say this, but you know it was quite predictable from
> the beginning that
> the arguments will end up somewhere in "linux console is the center of the
> universe, e-macs is mother of all apps and monospaced text is peak of
> human evolution".

Knowing that, the honest question is: if you knew where this would all
end up (in a heated argument), why did post your provocation in the
first place?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Who are the "spacists"?

2017-03-21 Thread Chris Angelico
On Wed, Mar 22, 2017 at 1:38 AM, Marko Rauhamaa  wrote:
> State of the art. Thankfully, the editor of the RFC chose not to use
> tabs.

Exactly. Because tabs are the wrong character to use for this kind of
thing. So you see, this is not any fault of tabs - what you're
pointing out is that misusing them causes problems. What a surprise.
But using them appropriately has yet been shown to cause any problems.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Who are the "spacists"?

2017-03-21 Thread Mikhail V
On 21 March 2017 at 15:49, Grant Edwards  wrote:
> On 2017-03-21, Mikhail V  wrote:
>
>> Didn't want to say this, but you know it was quite predictable from
>> the beginning that the arguments will end up somewhere in "linux
>> console is the center of the universe, e-macs is mother of all apps
>> and monospaced text is peak of human evolution".
>
> Well, I'm glad you've finally admitted it. :)
>
>> I don't know how to help, probably if there is an important document
>> which you want different people to read, just make plain txt, or
>> HTML table, Office document, PNG image, etc.  Or just use spaces if
>> it is for ASCII-art purposes.
>
> Well written code _is_ ASCII-art.

Written code is ASCII-art only if you live in the Monospaced Kingdom,
and even there, only if you draw ASCII-art in multi-line comment blocks.
But its true, that it will have a notable place in a museum.

Mikhail
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29857] Provide `sys._raw_argv` for host application's command line arguments

2017-03-21 Thread STINNER Victor

STINNER Victor added the comment:

> If the embedding application doesn't call PySys_SetArgv or PySys_SetArgvEx, 
> then there is no `argv` attribute defined in the sys module (I wasn't 
> actually sure what happened in that case, so I went and checked the code).

Ok, so just don't define sys._raw_argv in that case. But it doesn't seem enough 
to me to justify to make the attribute private.

https://docs.python.org/dev/library/sys.html#sys.getallocatedblocks can be seen 
as an implementation detail.The method name has no underscore prefix, but a 
simple fallback: return 0 if the feature is is not implemented.

--

___
Python tracker 

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



Re: Who are the "spacists"?

2017-03-21 Thread Marko Rauhamaa
Mikhail V :

> On 21 March 2017 at 14:42, Marko Rauhamaa  wrote:
>> - Draw this box starting from the top left corner and circling
>>   clockwise:
>>
>> +--+
>> |  |
>> |  |
>> +--+
>>
>
> Didn't want to say this, but you know it was quite predictable from
> the beginning that the arguments will end up somewhere in "linux
> console is the center of the universe, e-macs is mother of all apps
> and monospaced text is peak of human evolution".
>
> I don't know how to help, probably if there is an important document
> which you want different people to read, just make plain txt, or HTML
> table, Office document, PNG image, etc. Or just use spaces if it is
> for ASCII-art purposes.
>
> And on linux console, by default one does not even have good
> possibilities for text-mode pseudographics, it was more relevant in
> DOS where one had rich possibilities and programmable binary fonts.

Here's what I have studied today (HTTP/2):

 +---+
 | Length (24)   |
 +---+---+---+
 |   Type (8)|   Flags (8)   |
 +-+-+---+---+
 |R| Stream Identifier (31)  |
 +=+=+
 |   Frame Payload (0...)  ...
 +---+


   [...]


++
send PP || recv PP
   ,|  idle  |.
  / || \
 v  ++  v
  +--+  |   +--+
  |  |  | send H /  |  |
   ,--| reserved |  | recv H| reserved |--.
   |  | (local)  |  |   | (remote) |  |
   |  +--+  v   +--+  |
   |  | ++ |  |
   |  | recv ES || send ES |  |
   |   send H | ,---|  open  |---. | recv H   |
   |  |/||\|  |
   |  v   v ++ v   v  |
   |  +--+  |   +--+  |
   |  |   half   |  |   |   half   |  |
   |  |  closed  |  | send R /  |  closed  |  |
   |  | (remote) |  | recv R| (local)  |  |
   |  +--+  |   +--+  |
   |   || |   |
   |   | send ES /  |   recv ES / |   |
   |   | send R /   vsend R / |   |
   |   | recv R ++   recv R   |   |
   | send R /  `--->||<---'  send R / |
   | recv R | closed |   recv R   |
   `--->||<--'
++

   http://httpwg.org/specs/rfc7540.html>

State of the art. Thankfully, the editor of the RFC chose not to use
tabs.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


Manager for project templates, that allows "incremental" feature addition

2017-03-21 Thread Paul Moore
I'm looking for a utility that is something like cookiecutter, in that it 
generates a "template" project for me. However, I would like the ability to 
have a template add content based on runtime questions, something like

   Do you want to include a C extension? [yes/no]
   ... adds Extension() to setup.py, adds a C source file, etc
   Do you want to include tests? [yes/no]
   ... add a test directory with a sample test
   Tests to run under tox? [yes/no]
   ... add tox support (this question shouldn't be asked if the previous answer 
was "no")

As far as I know, this sort of feature isn't available in cookiecutter, nor is 
it planned.

Does anyone know of any similar utility that has this feature? If not, how do 
people handle it themselves? The "obvious" solution is just to have a 
full-featured template and cut out what's not needed, but for simple tasks, I 
find that cutting out the unneeded stuff can be a bigger job than writing the 
actual code.

Some examples of use cases I hit:

1. I need a trivial Python only, single-file project, to test some packaging 
issue.
2. Same, but I need a C module, that implements a single trivial function.
3. Added to either of the above, I need to include tests. Maybe with tox, maybe 
just standalone.
4. For a bigger project I might want Sphinx included as well.
5. Maybe add standard build scripts. At the moment I don't do this, but if I 
*had* a utility like I describe, this is one thing I'd like to do.

For all of these cases, I only really want to maintain a single template, as I 
don't want to have to maintain all of the common boilerplate (author 
name/email, version handling, classifiers etc) multiple times.

I don't use (or particularly want to switch to) an IDE. Generally I code using 
VS Code or Vim, on Windows, and run tests, builds etc from the command line.

Is there any such utility that I'm not aware of? If not, then what do people 
use to manage this sort of thing?

Paul
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29857] Provide `sys._raw_argv` for host application's command line arguments

2017-03-21 Thread Nick Coghlan

Nick Coghlan added the comment:

If the embedding application doesn't call PySys_SetArgv or PySys_SetArgvEx, 
then there is no `argv` attribute defined in the sys module (I wasn't actually 
sure what happened in that case, so I went and checked the code).

For the reference CLI, the relevant call happens in Py_Main() after all the 
interpreter level arguments have been processed.

--

___
Python tracker 

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



[issue29857] Provide `sys._raw_argv` for host application's command line arguments

2017-03-21 Thread STINNER Victor

STINNER Victor added the comment:

> For example, if Py_Main() is never called (for CPython), it would still be 
> None,

What is the content of sys.argv in that case? Can't we use the same value for 
sys._raw_argv?

--

___
Python tracker 

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



Re: Who are the "spacists"?

2017-03-21 Thread Jussi Piitulainen
Grant Edwards writes:

> Well written code _is_ ASCII-art.

:)
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29857] Provide `sys._raw_argv` for host application's command line arguments

2017-03-21 Thread Nick Coghlan

Nick Coghlan added the comment:

@Steven This is an implementation detail in the same sense that sys._getframe() 
is: it's not something that's actually going to make sense in all contexts. For 
example, if Py_Main() is never called (for CPython), it would still be None, 
and other implementations may not define it at all. And even when it's set for 
CPython, the exact details of what it contains are going to be at least 
somewhat platform dependent.

@Barry On Windows we define `mainw` rather than `main`, so it's the UTF-16-LE 
encoded text that is the "raw" form. That means the "raw" here refers to 
"before the Python interpreter CLI processing" - the normalization step to get 
the command line to wchar_t regardless of platform isn't going to be skipped 
(since the interpreter runtime itself never even sees the raw bytes in Python 
3).

One option would be to use a longer name like `sys._executable_argv`, since in 
the typical case, `sys.executable` and `sys._executable_argv[0]` will be the 
same.

@Victor It wouldn't be exactly the same as Py_GetArgcArgv, as I'd propose 
making a pristine copy *before* Py_Main() mutates anything - we do some 
in-place editing of entries while figuring out what "sys.argv[0]" should look 
like at the Python level.

--

___
Python tracker 

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



Re: Who are the "spacists"?

2017-03-21 Thread Grant Edwards
On 2017-03-21, Mikhail V  wrote:

> Didn't want to say this, but you know it was quite predictable from
> the beginning that the arguments will end up somewhere in "linux
> console is the center of the universe, e-macs is mother of all apps
> and monospaced text is peak of human evolution".

Well, I'm glad you've finally admitted it. :)

> I don't know how to help, probably if there is an important document
> which you want different people to read, just make plain txt, or
> HTML table, Office document, PNG image, etc.  Or just use spaces if
> it is for ASCII-art purposes.

Well written code _is_ ASCII-art.

-- 
Grant Edwards   grant.b.edwardsYow! Do I have a lifestyle
  at   yet?
  gmail.com

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Who are the "spacists"?

2017-03-21 Thread Grant Edwards
On 2017-03-21, Wildman via Python-list  wrote:

> I would love to hear also.  I've been using Linux for about
> 10 years and I have never had anything "break" because of a
> tab.  Sounds like a case of Chicken Little to me.

The main problem is that when you display/print a program that uses
tabs on something that expands them to every 8-columns, you often end
up with much of the code so far to the right you can't see much of it.

Another problem is that people will use tabs to do things like line up
comments to the right of code.  That only works if the program
displaying/printing the code has tab widths that match the authors.

-- 
Grant Edwards   grant.b.edwardsYow! I'm having a MID-WEEK
  at   CRISIS!
  gmail.com

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Who are the "spacists"?

2017-03-21 Thread Mikhail V
On 21 March 2017 at 14:42, Marko Rauhamaa  wrote:
> Wildman :
>
>> On Tue, 21 Mar 2017 06:01:26 +1100, Chris Angelico wrote:
>>> Can you ask your workmates to elaborate? I'd love to hear.
>>
>> I would love to hear also. I've been using Linux for about 10 years
>> and I have never had anything "break" because of a tab. Sounds like a
>> case of Chicken Little to me.
>
> Example:
>
> - Start emacs with the default settings.
>
> - Edit buffer "abc": C-x C-b abc
>
> - Start drawing: M-x picture-mode
>
> - Draw this box starting from the top left corner and circling
>   clockwise:
>
> +--+
> |  |
> |  |
> +--+
>

Didn't want to say this, but you know it was quite predictable from
the beginning that
the arguments will end up somewhere in "linux console is the center of the
universe, e-macs is mother of all apps and monospaced text is peak of
human evolution".

I don't know how to help, probably if there is an important document
which you want different people to read, just make plain
txt, or HTML table, Office document, PNG image, etc.
Or just use spaces if it is for ASCII-art purposes.

And on linux console, by default one does not even have good
possibilities for text-mode pseudographics, it was more relevant
in DOS where one had rich possibilities and programmable
binary fonts.

Mikhail
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29857] Provide `sys._raw_argv` for host application's command line arguments

2017-03-21 Thread STINNER Victor

STINNER Victor added the comment:

There is already an existing public C API get retrieve original program 
arguments *as text*:

/* Make the *original* argc/argv available to other modules.
   This is rare, but it is needed by the secureware extension. */

void
Py_GetArgcArgv(int *argc, wchar_t ***argv)
{
*argc = orig_argc;
*argv = orig_argv;
}

Are you talking about exposing these arguments at the Python level?

--

___
Python tracker 

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



[issue29857] Provide `sys._raw_argv` for host application's command line arguments

2017-03-21 Thread STINNER Victor

STINNER Victor added the comment:

> Well, "raw args" implies minimal or no processing,

Ok, so call it "original", sys.orig_arv, in that case ;-)

--

___
Python tracker 

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



Re: Who are the "spacists"?

2017-03-21 Thread Marko Rauhamaa
Wildman :

> On Tue, 21 Mar 2017 06:01:26 +1100, Chris Angelico wrote:
>> Can you ask your workmates to elaborate? I'd love to hear.
>
> I would love to hear also. I've been using Linux for about 10 years
> and I have never had anything "break" because of a tab. Sounds like a
> case of Chicken Little to me.

Example:

- Start emacs with the default settings.

- Edit buffer "abc": C-x C-b abc

- Start drawing: M-x picture-mode

- Draw this box starting from the top left corner and circling
  clockwise:

+--+
|  |
|  |
+--+

- Move the cursor to the beginning of the first line of the box.
  Try to move the box to the left by three columns:

  C-SPC C-n C-n C-n C-f C-f C-f C-x r k

  What you get is:

 +--+
|  |
|  |
+--+

  because only the first line was indented with spaces. Emacs uses
  when opening the other lines.

If you disable tabs (or untabify), you get the intended result:

 +--+
 |  |
 |  |
 +--+

This is only an example. Analogous annoyances crop up in all kinds of
editing.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29857] Provide `sys._raw_argv` for host application's command line arguments

2017-03-21 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On Mar 21, 2017, at 11:47 AM, STINNER Victor wrote:

>No, text please. Text is just more convenient in Python, and it's trivial to
>retrieve original bytes:
>
>raw_args_bytes = [os.fsencode(arg) for arg in sys._raw_args]

Well, "raw args" implies minimal or no processing, so bytes would make the
most sense.  It doesn't bother me that it's inconvenient; this won't be an oft
used API and the conversion to strings should be just as easy.

--

___
Python tracker 

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



Exporting Tensorflow inceptionv3 graph for weight and bias extraction

2017-03-21 Thread Zizwan
Anyone can help me with this?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Who are the "spacists"?

2017-03-21 Thread Wildman via Python-list
On Tue, 21 Mar 2017 06:01:26 +1100, Chris Angelico wrote:

> On Tue, Mar 21, 2017 at 4:39 AM, Steve D'Aprano
>  wrote:
>> And yet I'm forever being told by my Linux sys admin work mates "don't use
>> tabs, because they break everything". For another example, see JMZ's essay
>> (its already been linked to twice in this thread, look it up).
>>
>> We've had a similar attitude right here from Marko, who insists that
>> anything except 8-column tabs is the Devil's Work. (Or something like
>> that -- to be perfectly honest, I'm not really sure I understand *what*
>> Marko's objection is.)
>>
>> So okay, if tabs work fine with Unix tools, why do so many Unix people avoid
>> tabs as if they were radioactive plague?
> 
> Can you ask your workmates to elaborate? I'd love to hear.
> 
> ChrisA

I would love to hear also.  I've been using Linux for about
10 years and I have never had anything "break" because of a
tab.  Sounds like a case of Chicken Little to me.

-- 
 GNU/Linux user #557453
The cow died so I don't need your bull!
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue17792] Unhelpful UnboundLocalError due to del'ing of exception target

2017-03-21 Thread Ivan Levkivskyi

Changes by Ivan Levkivskyi :


--
nosy: +levkivskyi

___
Python tracker 

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



[issue29593] Improve UnboundLocalError message for deleted names

2017-03-21 Thread Ivan Levkivskyi

Changes by Ivan Levkivskyi :


--
nosy: +levkivskyi

___
Python tracker 

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



[issue29859] Return code of pthread_* in thread_pthread.h is not used for perror

2017-03-21 Thread Daniel Birnstiel

Changes by Daniel Birnstiel :


--
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



Re: Python.NET question?

2017-03-21 Thread Tristan B. Kildaire

On 2017/03/21 1:46 PM, Steve D'Aprano wrote:

On Tue, 21 Mar 2017 08:39 pm, Tristan B. Kildaire wrote:


On 2017/03/21 11:07 AM, Ivo Bellin Salarin wrote:

IronPython?

Le mar. 21 mars 2017 08:52, Tristan B. Kildaire  a
écrit :


Is Python.NET a version of Python that compiles Python source code to
Microsoft's IR for running by a MS runtime?
--
https://mail.python.org/mailman/listinfo/python-list


I heard of Python.NET. ANyway, what is IronPython (is that the one that
runs on an MS runtime?). The name is something I remember.



I'm not sure if Python.NET is a new name for "Python for .NET", or a
completely different project. Do you have a URL for it?

Python for .NET brings the regular CPython interpreter to the .NET and Mono
environments.

IronPython is a reimplementation of Python, written in C# as managed code
for .Net, running on the CLR virtual machine. It doesn't use a GIL, and is
sometimes considered a little faster than CPython.

IronPython:
http://ironpython.net/

Python for .Net:
https://github.com/pythonnet/pythonnet
http://pythonnet.github.io/
https://pypi.python.org/pypi/pythonnet





Ah. It was IronPython then. Thanks.
--
https://mail.python.org/mailman/listinfo/python-list


Re: How to package my project and make it ready to be installed by using pip

2017-03-21 Thread Daiyue Weng
the problem has been solved, as I forgot to define

py_modules=[...]

for a few python files needed to be installed.

cheers

On 21 March 2017 at 08:09, Glenn Hutchings  wrote:

> On Monday, 20 March 2017 17:21:04 UTC, Daiyue Weng  wrote:
> > If I tried
> >
> > pip3 install git+https://user_n...@bitbucket.org/user_name/
> project_name.git
> >
> > the package would get installed, but there are no python files that have
> > been installed in /usr/local/lib/python3.5/dist-packages/project_name
> >
> > Hence I couldn't import any class in the package in python.
> >
> > I am wondering how to fix this.
>
> Where are the files that did get installed?  It's possible they were put
> somewhere you're not expecting.  (Not, I hope, in a folder called
> 'project_name.git' -- that would be rather unhelpful!)
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: cross python version randomness

2017-03-21 Thread Robin Becker

On 21/03/2017 09:43, Pavol Lisy wrote:

On 3/21/17, Kev Dwyer  wrote:

Robin Becker wrote:


Is there a way to get the same sequences of random numbers in python 2.7
and python >= 3.3?

I notice that this simple script produces different values in python 2.7
and >=3.3

C:\code\hg-repos\reportlab>cat s.py
import sys, random
print(sys.version)
random.seed(103)
for i in range(5):
 print(i, random.randint(10,25))

C:\code\hg-repos\reportlab>\python27\python s.py
2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit
(AMD64)] 0 25
1 17
2 21
3 21
4 13



This is inspiring Robin! :)

import sys, random
print(sys.version)

def randint(a, b):
return int(random.random()*(b-a+1))+a

random.seed(103)
for i in range(5):
print(i, randint(10,25))
3.6.0 |Anaconda custom (64-bit)| (default, Dec 23 2016, 12:22:00)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]
0 25
1 17
2 21
3 21
4 13

Output seems to be same as in your 2.7 version :)

So if you are sure that sequences of random.random are same then you
could use it.

You could also save a sequence to file and use it repeatedly. (if it
is not performance problem for you)

PL.

I'm not as inspired as you; for the present I have chickened out and just 
modified the 2.7 randrange method to monkeypatch the 3.x random.Random class. It 
seems to be ok and allows all the test code to use random.randint, but for small 
widths I think your function is correct.

--
Robin Becker

--
https://mail.python.org/mailman/listinfo/python-list


Re: cross python version randomness

2017-03-21 Thread Steve D'Aprano
On Tue, 21 Mar 2017 08:30 pm, Robin Becker wrote:

> Looking in random.py it sesms to be true. Pity no backwards compatibility
> mode. I don't actually care about the quality of the ints produced, but I
> do care about reproducibility, luckily I think it's feasible to monkey
> patch the 2.7 method back in.

A few years ago I came across that, and raised it on the bug tracker. The
core devs decided that the backwards compatibility promise only applies to
the output of random.random() itself, not the assorted other methods.

If you care about the specific sequence of pseudo-random numbers generated
by a particular method across versions, you have to use your own
implementation. You can trust that random.random()'s output alone will be
reproducible, anything more than that you have to manage yourself.




-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python.NET question?

2017-03-21 Thread Steve D'Aprano
On Tue, 21 Mar 2017 08:39 pm, Tristan B. Kildaire wrote:

> On 2017/03/21 11:07 AM, Ivo Bellin Salarin wrote:
>> IronPython?
>>
>> Le mar. 21 mars 2017 08:52, Tristan B. Kildaire  a
>> écrit :
>>
>>> Is Python.NET a version of Python that compiles Python source code to
>>> Microsoft's IR for running by a MS runtime?
>>> --
>>> https://mail.python.org/mailman/listinfo/python-list
>>>
> I heard of Python.NET. ANyway, what is IronPython (is that the one that
> runs on an MS runtime?). The name is something I remember.


I'm not sure if Python.NET is a new name for "Python for .NET", or a
completely different project. Do you have a URL for it?

Python for .NET brings the regular CPython interpreter to the .NET and Mono
environments.

IronPython is a reimplementation of Python, written in C# as managed code
for .Net, running on the CLR virtual machine. It doesn't use a GIL, and is
sometimes considered a little faster than CPython.

IronPython:
http://ironpython.net/
 
Python for .Net:
https://github.com/pythonnet/pythonnet
http://pythonnet.github.io/
https://pypi.python.org/pypi/pythonnet




-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29857] Provide `sys._raw_argv` for host application's command line arguments

2017-03-21 Thread STINNER Victor

STINNER Victor added the comment:

> As bytes?

No, text please. Text is just more convenient in Python, and it's trivial to 
retrieve original bytes:

raw_args_bytes = [os.fsencode(arg) for arg in sys._raw_args]

--
nosy: +haypo

___
Python tracker 

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



[issue29857] Provide `sys._raw_argv` for host application's command line arguments

2017-03-21 Thread Steven D'Aprano

Steven D'Aprano added the comment:

Why is the name flagged as a private implementation detail? I.e. a single 
leading underscore. I'd be reluctant to rely on this in production code, given 
how strong the _private convention is.

Suggest just `sys.raw_args` instead.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue29859] Return code of pthread_* in thread_pthread.h is not used for perror

2017-03-21 Thread INADA Naoki

INADA Naoki added the comment:

OK, perror() writes to stderr too.  fair enough.

--

___
Python tracker 

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



[issue29736] Optimize builtin types constructor

2017-03-21 Thread STINNER Victor

STINNER Victor added the comment:

The following types were patched to use Argument Clinic (use now 
_PyArg_ParseTupleAndKeywordsFast or don't accept keyword arguments anymore):

* complex
* float (don't accept keywords anymore)
* list
* tuple

The following types still uses PyArg_ParseTupleAndKeywords:

* bytes
* bytearray
* int (PyLong)
* str (unicode_new)

bool doesn't accept keywords anymore and uses now PyArg_UnpackTuple().

--

___
Python tracker 

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



[issue29859] Return code of pthread_* in thread_pthread.h is not used for perror

2017-03-21 Thread Daniel Birnstiel

Daniel Birnstiel added the comment:

While I agree, fprintf it not really nice, I looked through other parts of the 
python source where information is printed to stderr and fprintf was used there 
as well, so I fell back to it myself.

% grep -rnw . -e "fprintf(stderr," | wc -l  

   178

Using threading and multiprocessing is insane, I know that. Nevertheless the 
error codes returned by the pthread_* calls are processed incorrectly, so I 
would consider this a bug worth fixing.

--

___
Python tracker 

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



[issue29867] Add asserts in PyXXX_GET_SIZE macros

2017-03-21 Thread STINNER Victor

STINNER Victor added the comment:

We should test to run popular C extensions like numpy, PyQt, cython, pillow, 
etc. with a patched Python to see if it's common to use a "GET" macro to "set" 
a size. Maybe test also Django see it probably uses many C extensions. I don't 
ask to test all these modules, but at least a few of them. By "testing", I mean 
run the test suite of these projects.

--

___
Python tracker 

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



Re: cross python version randomness

2017-03-21 Thread Pavol Lisy
On 3/21/17, Kev Dwyer  wrote:
> Robin Becker wrote:
>
>> Is there a way to get the same sequences of random numbers in python 2.7
>> and python >= 3.3?
>>
>> I notice that this simple script produces different values in python 2.7
>> and >=3.3
>>
>> C:\code\hg-repos\reportlab>cat s.py
>> import sys, random
>> print(sys.version)
>> random.seed(103)
>> for i in range(5):
>>  print(i, random.randint(10,25))
>>
>> C:\code\hg-repos\reportlab>\python27\python s.py
>> 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit
>> (AMD64)] 0 25
>> 1 17
>> 2 21
>> 3 21
>> 4 13
>>
>> C:\code\hg-repos\reportlab>\python33\python s.py
>> 3.3.5 (v3.3.5:62cf4e77f785, Mar  9 2014, 10:35:05) [MSC v.1600 64 bit
>> (AMD64)] 0 24
>> 1 16
>> 2 12
>> 3 13
>> 4 22
>>
>> However, when I use random.random() all seems to be the same so this
>> script C:\code\hg-repos\reportlab>cat u.py
>> import sys, random
>> print(sys.version)
>> random.seed(103)
>> for i in range(5):
>>  print(i, random.random())
>>
>> seems to be fine
>>
>>
>> C:\code\hg-repos\reportlab>\python27\python u.py
>> 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit
>> (AMD64)] (0, 0.9790501200727744)
>> (1, 0.45629827629184827)
>> (2, 0.7188470341002364)
>> (3, 0.7348862425853395)
>> (4, 0.21490166849706338)
>>
>> C:\code\hg-repos\reportlab>\python33\python u.py
>> 3.3.5 (v3.3.5:62cf4e77f785, Mar  9 2014, 10:35:05) [MSC v.1600 64 bit
>> (AMD64)] 0 0.9790501200727744
>> 1 0.45629827629184827
>> 2 0.7188470341002364
>> 3 0.7348862425853395
>> 4 0.21490166849706338
>>
>> presumably randint is doing something different to get its values.
>
>
> The docs [https://docs.python.org/3/library/random.html#random.randrange]
> for randrange have this note:
>
> Changed in version 3.2: randrange() is more sophisticated about producing
> equally distributed values. Formerly it used a style like int(random()*n)
> which could produce slightly uneven distributions.
>
> Maybe that's the explanation?  Unfortunately I don't have an install of
> 3.0/1 to test against.
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>

This is inspiring Robin! :)

import sys, random
print(sys.version)

def randint(a, b):
return int(random.random()*(b-a+1))+a

random.seed(103)
for i in range(5):
print(i, randint(10,25))
3.6.0 |Anaconda custom (64-bit)| (default, Dec 23 2016, 12:22:00)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]
0 25
1 17
2 21
3 21
4 13

Output seems to be same as in your 2.7 version :)

So if you are sure that sequences of random.random are same then you
could use it.

You could also save a sequence to file and use it repeatedly. (if it
is not performance problem for you)

PL.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: numpy indexing performance

2017-03-21 Thread Olaf Dietrich
Olaf Dietrich :
> This is a simplified example of a Monte Carlo
> simulation where random vectors (here 2D vectors,
> which are all zero) are summed (the result is in
> r1 and r2 or r, respectively):
> 
> def case1():
> import numpy as np
> M = 10
> N = 1
> r1 = np.zeros(M)
> r2 = np.zeros(M)
> s1 = np.zeros(N)
> s2 = np.zeros(N)
> for n in range(1000):
> ind = np.random.random_integers(N, size=M) - 1
> r1 += s1[ind]
> r2 += s2[ind]
> 
> def case2():
> import numpy as np
> M = 10
> N = 1
> r = np.zeros((M, 2))
> s = np.zeros((N, 2))
> for n in range(1000): 
> ind = np.random.random_integers(N, size=M) - 1
> r += s[ind]
> 
> import timeit
> 
> print("case1:", timeit.timeit(
> "case1()", setup="from __main__ import case1", number=1))
> print("case2:", timeit.timeit(
> "case2()", setup="from __main__ import case2", number=1))
> 
> 
> Resulting in:
> 
> case1: 2.6224704339983873
> case2: 4.374910838028882

I should add that I tried this with Python 3.4.2 and with
Python 2.7.0 (on linux, x64), NumPy version 1.8.2; the
performance differences were the same with both Python
interpreters.


> Why is case2 significantly slower (almost by a
> factor of 2) than case1? There should be the same number
> of operations (additions) in both cases; the main
> difference is the indexing.
> 
> Is there another (faster) way to avoid the separate
> component arrays r1 and r2? (I also tried
> r = np.zeros(M, dtype='2d'), which was comparable
> to case2.)


Olaf
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python.NET question?

2017-03-21 Thread Tristan B. Kildaire

On 2017/03/21 11:07 AM, Ivo Bellin Salarin wrote:

IronPython?

Le mar. 21 mars 2017 08:52, Tristan B. Kildaire  a
écrit :


Is Python.NET a version of Python that compiles Python source code to
Microsoft's IR for running by a MS runtime?
--
https://mail.python.org/mailman/listinfo/python-list

I heard of Python.NET. ANyway, what is IronPython (is that the one that 
runs on an MS runtime?). The name is something I remember.



I know JPython compiles to Java's IR (Bytecode) and therefore runs on 
the JVM runtime.

--
https://mail.python.org/mailman/listinfo/python-list


Re: cross python version randomness

2017-03-21 Thread Robin Becker

..


presumably randint is doing something different to get its values.



The docs [https://docs.python.org/3/library/random.html#random.randrange]
for randrange have this note:

Changed in version 3.2: randrange() is more sophisticated about producing
equally distributed values. Formerly it used a style like int(random()*n)
which could produce slightly uneven distributions.

Maybe that's the explanation?  Unfortunately I don't have an install of
3.0/1 to test against.



Looking in random.py it sesms to be true. Pity no backwards compatibility mode. 
I don't actually care about the quality of the ints produced, but I do care 
about reproducibility, luckily I think it's feasible to monkey patch the 2.7 
method back in.

--
Robin Becker

--
https://mail.python.org/mailman/listinfo/python-list


  1   2   >