[issue22735] Fix various crashes exposed through mro() customization

2014-11-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I think forbidding reentrancy would indeed be a good idea.

--
nosy: +pitrou

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



[issue22789] Compress the marshalled data in PYC files

2014-11-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

FWIW, I personally doubt this would actually reduce startup time. Disk I/O cost 
is in the first access, not in the transfer size (unless we're talking hundreds 
of megabytes). But in any case, someone interested has to do measurements :-)

--

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



[issue20220] TarFile.list() outputs wrong time

2014-11-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

May be issue6478 is related.

--
nosy: +berker.peksag

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



[issue22804] Can't run Idle in Windows 8 or windows 64

2014-11-06 Thread nx u

New submission from nx u:

Hi,

I have just downloaded and installed python34. When I run the short cut  IDLE 
python gui nothing happens  ( I think a command window appears briefly - not 
sure as this happens so quickly).  My machine runs windows 8 and 64 bit version 
of . I did the same on a windows 7 64 bit machine and double clicking the 
Python IDLE gui 32 bit doesn't work.

Not quite sure what's going on. Our machines are located in a school with GPOs 
controlling access and security. I am from the ICT support team. There isn't 
much reported on this issue on the internet either except a couple of entries 
in stackoverflow. But the solutions offered are far off the mark. Please help. 
The documentation on the Python web site is not clear or not detailed enough to 
diagnose the fault.

--
components: IDLE
messages: 230732
nosy: nx.u
priority: normal
severity: normal
status: open
title: Can't run Idle in Windows 8 or windows 64
versions: Python 3.4

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



[issue19102] Add tests for CLI of the tabnanny module

2014-11-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Added comments on Rietveld.

Although tabnanny is located in the Lib directory, not in the Tools directory, 
technically it is a script. May be move test_tabnanny.py to Lib/test/test_tools?

--
assignee:  - berker.peksag
nosy: +serhiy.storchaka
type:  - enhancement
versions: +Python 3.5 -Python 3.4

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



[issue7559] TestLoader.loadTestsFromName swallows import errors

2014-11-06 Thread Robert Collins

Robert Collins added the comment:

Its backported in unittest2 0.8.0 which is available on pypi for 2.6+ and 3.2+.

The changes are large enough that I'd hesitate to backport them in cPython 
itself.

--

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



[issue22804] Can't run Idle in Windows 8 or windows 64

2014-11-06 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

You can try to run IDLE from a command prompt. Type the command:
  path_to_python34.exe -m idlelib

and look at error messages.

--
nosy: +amaury.forgeotdarc

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



[issue15500] Python should support naming threads

2014-11-06 Thread Kovid Goyal

Kovid Goyal added the comment:

Just FYI, a pure python2 implementation that monkey patches Thread.start() to 
set the OS level thread name intelligently.

import ctypes, ctypes.util, threading
libpthread_path = ctypes.util.find_library(pthread)
if libpthread_path:
libpthread = ctypes.CDLL(libpthread_path)
if hasattr(libpthread, pthread_setname_np):
pthread_setname_np = libpthread.pthread_setname_np
pthread_setname_np.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
pthread_setname_np.restype = ctypes.c_int
orig_start = threading.Thread.start
def new_start(self):
orig_start(self)
try:
name = self.name
if not name or name.startswith('Thread-'):
name = self.__class__.__name__
if name == 'Thread':
name = self.name
if name:
if isinstance(name, unicode):
name = name.encode('ascii', 'replace')
ident = getattr(self, ident, None)
if ident is not None:
pthread_setname_np(ident, name[:15])
except Exception:
pass  # Don't care about failure to set name
threading.Thread.start = new_start

--
nosy: +kovid

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



[issue20289] Make cgi.FieldStorage a context manager

2014-11-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Added comments on Rietveld.

--
nosy: +serhiy.storchaka
type: behavior - enhancement

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



[issue21579] Python 3.4: tempfile.close attribute does not work

2014-11-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

If it is possible to cancel the effect of the O_TEMPORARY flag, we can use it 
to implement this feature on all platforms. But if it is not possible, we have 
several options:

1. Just close this issue and do nothing more. This was undocumented and 
non-portable feature.

2. Implement delete as readonly property. This is similar to 1 but makes the 
failure loud.

3. Implement this feature on non-Windows, document that it is non-Windows only 
feature, and raise an exception in delete setter on Windows.

4. Same as 3, but emit deprecation warning in delete setter on non-Windows. In 
future this should be replaced with solution 2.

--

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



[issue22650] set up and use VM for net access in the test suite

2014-11-06 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 39536b377241 by Georg Brandl in branch '3.4':
#22650: test suite: load Unicode test data files from www.pythontest.net
https://hg.python.org/cpython/rev/39536b377241

--
nosy: +python-dev

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



[issue21579] Python 3.4: tempfile.close attribute does not work

2014-11-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

See also issue14243.

--

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



[issue22766] collections.Counter's in-place operators should return NotImplemented for unsupported types

2014-11-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 I've posted to python-list and python-dev.  I'll report back here the 
 findings, if any.

http://comments.gmane.org/gmane.comp.python.devel/150073

--
nosy: +serhiy.storchaka

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



[issue19094] urljoin should raise a TypeError if URL is not a string

2014-11-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

About acceptable behavior with wrong arguments types see discussions in 
issue22766 and http://comments.gmane.org/gmane.comp.python.devel/150073 .

--
nosy: +serhiy.storchaka
versions: +Python 3.5 -Python 3.3

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



[issue22650] set up and use VM for net access in the test suite

2014-11-06 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0af36ea1d010 by Georg Brandl in branch '2.7':
#22650: test suite: load Unicode test data files from www.pythontest.net
https://hg.python.org/cpython/rev/0af36ea1d010

--

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



[issue20220] TarFile.list() outputs wrong time

2014-11-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 May be issue6478 is related.

I'm not sure. issue6478 looks like a Python stdlib bug, while this issue looks 
like a libc problem.

--

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



[issue20220] TarFile.list() outputs wrong time

2014-11-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

David, could you try the patch in msg230703 and see if it fixes the problem on 
your buildbot?

--

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



[issue20220] TarFile.list() outputs wrong time

2014-11-06 Thread David Edelsohn

David Edelsohn added the comment:

Unfortunately, the patch does not fix the failures of running test_imaplib 
before test_tarfile or test_datetime.

--

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



[issue22805] Having pythontest.net index.html link to hg repo

2014-11-06 Thread Brett Cannon

New submission from Brett Cannon:

For pythontest.net, it would be nice if the index.html page that is (supposed 
to be) served linked to the hg repo to make it more discoverable how to add 
files to the domain.

--
assignee: brett.cannon
messages: 230747
nosy: brett.cannon
priority: low
severity: normal
stage: needs patch
status: open
title: Having pythontest.net index.html link to hg repo
type: enhancement

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



[issue22806] regrtest: add switch -c to run only modified tests

2014-11-06 Thread Georg Brandl

New submission from Georg Brandl:

A quick way to select only tests that are modified in the checkout.

--
components: Tests
files: regrtest_changed.diff
keywords: patch
messages: 230748
nosy: georg.brandl, pitrou
priority: normal
severity: normal
status: open
title: regrtest: add switch -c to run only modified tests
type: enhancement
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file37138/regrtest_changed.diff

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



[issue22766] collections.Counter's in-place operators should return NotImplemented for unsupported types

2014-11-06 Thread Jim Jewett

Jim Jewett added the comment:

I wish there were an APIMismatchError superclass to unify
(AttributeError, TypeError).  But the wart probably isn't enough to
justify the surgery.

On Thu, Nov 6, 2014 at 8:48 AM, Serhiy Storchaka rep...@bugs.python.org wrote:

 Serhiy Storchaka added the comment:

 I've posted to python-list and python-dev.  I'll report back here the 
 findings, if any.

 http://comments.gmane.org/gmane.comp.python.devel/150073

 --
 nosy: +serhiy.storchaka

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue22766
 ___

--

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



[issue22806] regrtest: add switch -c to run only modified tests

2014-11-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Unfortunately this doesn't work with tests for pickle, json or tkinter.

I'm afraid this feature would make false promise. Without careful check you can 
not be confident that all modified tests are selected. If you going to add this 
switch, it should emit a


*  *
*   LOUD WARNING   *
*  *


and enumerate all modified files containing 'test' in its path which are not 
recognized as valid test name.

--
nosy: +serhiy.storchaka

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



[issue22806] regrtest: add switch -c to run only modified tests

2014-11-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I agree this is more dangerous than useful.
(even if you haven't modified a test it may still be impacted by some other 
change)

--

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



[issue22806] regrtest: add switch -c to run only modified tests

2014-11-06 Thread Georg Brandl

Georg Brandl added the comment:

Well, this is not meant as a comprehensive run ALL impacted tests because 
that is impossible in general :)

An alternate suggestion would be to allow filenames like Lib/test/test_foo.py 
as arguments to regrtest. Then I could run without the switch using

.../regrtest.py `hg status -amn`

--

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



[issue16353] add function to os module for getting path to default shell

2014-11-06 Thread Matt Frank

Matt Frank added the comment:

In msg174930 Christian Heimes (christian.heimes) wrote:
 I've tested confstr(CS_PATH) on Linux, Mac OS X, Solaris, HP-UX
 and BSD. It works and the path to `sh` is always included.

In msg230713 Ned Deily(ned.deily) wrote:
 ignore Lib/macpath.py.
 [...]
 OS X uses Lib/posixpath.py.

These two messages have convinced me that the correct approach is to kick the 
can down the road.  I will file a new issue and patch to fix os.defpath (by 
initializing os.defpath by calling confstr(CS_PATH)).  Then I will file a new 
issue and patch that will define a reasonable os.confstr() for platforms where 
HAVE_CONFSTR is not defined.

--

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



[issue20160] broken ctypes calling convention on MSVC / 64-bit Windows (large structs)

2014-11-06 Thread Matthias Klose

Matthias Klose added the comment:

steve, please can we keep this issue open until this is forwarded and accepted 
upstream?

--
nosy: +doko
resolution: fixed - remind
status: closed - open

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



[issue22806] regrtest: add switch -c to run only modified tests

2014-11-06 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

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



[issue16353] add function to os module for getting path to default shell

2014-11-06 Thread Matt Frank

Matt Frank added the comment:

In msg230720 Akira Li (akira) wrote:
 os.defpath is supposed to be ':'+CS_PATH, e.g., look at glibc (C library
 used on Linux) sysdeps/posix/spawni.c I don't know whether it is
 possible to change CS_PATH without recompiling every statically linked
 executable on a system, sysdeps/unix/confstr.h:

   #define CS_PATH /bin:/usr/bin

 Though this issue is about the path to the standard shell sh/cmd.exe.
 It is not about os.defpath.

I understand this issue is about the path to the standard shell.
My argument is that os.defpath is the wrong tool for finding that
path, and os.confstr('CS_PATH') is the correct tool, as you originally
suggested in msg224514.

 The patch [1] has tests. Have you tried to run them?
 The tests *pass* at least on one system ;)

 [...]

 os.get_shell_executable() does not use cwd. Neither the documentation
 nor the code in the patch suggest that.

I ran the tests (and the entire Python test suite) before I wrote my
first message.  But you didn't test what happens when there is a bogus
'sh' somewhere along the path.  You also have a bug in your path
searching loop that interprets an empty element on the path as /.
Here's the current failure mode:

Go to root on your Posix system.  With su or sudo create an
executable file named sh.  (for example cd /; sudo touch sh; sudo
chmod +x sh).  Then go back to your python interpreter (with the
patch applied) and run os.get_shell_executable().  The returned
result will be '/sh'.

The loop _should_ be treating empty path elements as current working
directory.  (In the glibc sysdeps/posix/spawni.c file you pointed to
look around line 281, by the comment that says /* Two adjacent
colons, or a colon at the beginning or the end of 'PATH' means to
search the current directory.*/)

But if you fix the loop to iterate over the path correctly (including
'cwd') then you will find that putting an executable named 'sh' in the
current working directory will make os.get_shell_executable() return
the sh in the current working directory (because os.defpath says it
should).

Note also, that glibc's spawni() uses two different default paths.
One is for if the user didn't specify their PATH variable (that's the
one where they use :/bin:/usr/bin) and a completely different (built
in path is used in the spawn*p* version) if it turns out that the file
is a script that needs to run under the system sh.  (On line 290 they
call maybe_script_execute(), which calls script_execute(), which uses
_PATH_BSHELL.)

 os.defpath is the default search path used by exec*p* and spawn*p*
 i.e., if os.defpath is incorrect for these system then os.exec*p* and
 os.spawn*p* functions could also be broken.

I'll look into it.

 I don't remember exactly the motivation to use os.defpath instead of
 os.confstr('CS_PATH').

The motivation was in msg224514.  You wrote:
 In the absense of os.confstr('CS_PATH') on Android (msg175006),
 os.defpath seems appropriate than os.environ['PATH'] to expand 'sh'
 basename to the full path to be used by subprocess later.

But os.defpath doesn't work on Android either (because it is hardcoded
to ':/bin:/usr/bin').

--

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



[issue22789] Compress the marshalled data in PYC files

2014-11-06 Thread Stefan Behnel

Stefan Behnel added the comment:

FWIW, LZ4HC compression sounds like an obvious choice for write-once-read-many 
data like .pyc files to me. Blosc shows that you can achieve a pretty major 
performance improvement just by stuffing more data into less space (although it 
does it for RAM and CPU cache, not disk). And even if it ends up not being 
substantially faster for the specific case of .pyc files, there is really no 
reason why they should take more space on disk than necessary, so it's a sure 
win in any case.

--
nosy: +scoder

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



[issue16255] subrocess.Popen needs /bin/sh but Android only has /system/bin/sh

2014-11-06 Thread Matt Frank

Matt Frank added the comment:

Assuming issue16353 is fixed using 
http://bugs.python.org/file36196/os.get_shell_executable.patch the appropriate 
way to find the path to the default shell is by calling 
os.get_shell_executable().

This is the 1-liner patch that uses os.get_shell_executable() in Popen() 
instead of the hard-coded string /bin/sh.

--
keywords: +patch
Added file: http://bugs.python.org/file37139/popen-no-hardcode-bin-sh.patch

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



[issue22796] Support for httponly/secure cookies reintroduced lax parsing behavior

2014-11-06 Thread Tim Graham

Tim Graham added the comment:

Django's test suite doesn't reveal any regressions. All the changes there are 
expected as far as I can see.

--

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



[issue22807] uuid.uuid1() should use uuid_generate_time_safe() if available

2014-11-06 Thread Barry A. Warsaw

New submission from Barry A. Warsaw:

I'm classifying this as a security issue, since using uuid_generate_time() -- 
i.e. the not _safe() variety -- does return collisions in real world cases that 
we've seen, and those could have security implications. However, I don't know 
that this can be exploited in any real world cases, so I'm not making it 
private or sending to security@.

The basic problem is that uuid.uuid1() uses uuid_generate_time(3), but if the 
synchronization methods used in that C function's manpage are not used, then 
two concurrent processes can -- and do in our cases -- return the same UUID.

I would propose that if uuid_generate_time_safe() is available, this should be 
used instead, and the return value should be checked to see if a safe method 
was used.  If not, then uuid1() should fall back to the pure-Python approach.

--
components: Library (Lib)
keywords: security_issue
messages: 230759
nosy: barry
priority: normal
severity: normal
status: open
title: uuid.uuid1() should use uuid_generate_time_safe() if available
versions: Python 2.7, Python 3.4, Python 3.5

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



[issue22807] uuid.uuid1() should use uuid_generate_time_safe() if available

2014-11-06 Thread Alex Gaynor

Alex Gaynor added the comment:

FWIW, I'm not convinced the pure python fallback code is sufficient either; 
time.time() doesn't have the necessary resolution AFAIK? Also clock_seq is 
generated using the random module's messerne twister, not SystemRandom().

--
nosy: +alex

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



[issue16353] add function to os module for getting path to default shell

2014-11-06 Thread Akira Li

Akira Li added the comment:

 Matt Frank added the comment:

 In msg230720 Akira Li (akira) wrote:
 os.defpath is supposed to be ':'+CS_PATH, e.g., look at glibc (C library
 used on Linux) sysdeps/posix/spawni.c I don't know whether it is
 possible to change CS_PATH without recompiling every statically linked
 executable on a system, sysdeps/unix/confstr.h:

   #define CS_PATH /bin:/usr/bin

 Though this issue is about the path to the standard shell sh/cmd.exe.
 It is not about os.defpath.

 I understand this issue is about the path to the standard shell.
 My argument is that os.defpath is the wrong tool for finding that
 path, and os.confstr('CS_PATH') is the correct tool, as you originally
 suggested in msg224514.


I'll repeat os.defpath definition that I've cited in the same message
msg224514:

  The default search path used by exec*p* and spawn*p* if the
  environment doesn’t have a 'PATH' key. Also available via os.path.

1. os.defpath should work (contain the path to the standard shell)
   everywhere where os.confstr(CS_PATH) works.

2. And it might be easier to customize e.g., on systems where there is
   no os.confstr or where changing CS_PATH involves recompiling crucial
   system processes.

If these two statements are not true then os.defpath could be dropped.

 The patch [1] has tests. Have you tried to run them?
 The tests *pass* at least on one system ;)

 [...]

 os.get_shell_executable() does not use cwd. Neither the documentation
 nor the code in the patch suggest that.

 I ran the tests (and the entire Python test suite) before I wrote my
 first message.  But you didn't test what happens when there is a bogus
 'sh' somewhere along the path.  You also have a bug in your path
 searching loop that interprets an empty element on the path as /.
 Here's the current failure mode:

 Go to root on your Posix system.  With su or sudo create an
 executable file named sh.  (for example cd /; sudo touch sh; sudo
 chmod +x sh).  Then go back to your python interpreter (with the
 patch applied) and run os.get_shell_executable().  The returned
 result will be '/sh'.
 But if you fix the loop to iterate over the path correctly (including
 'cwd') then you will find that putting an executable named 'sh' in the
 current working directory will make os.get_shell_executable() return
 the sh in the current working directory (because os.defpath says it
 should).


Comment in the patch explicitly says that '' is interpreted as '/'. The
intent is to exclude the current working directory, thinking that /sh
executable can create only root. And root can do anything to the machine
anyway.

I agree. It is a misfeature. I've uploaded a new patch that excludes ''
completely. The previous code tried to be too cute.

 The loop _should_ be treating empty path elements as current working
 directory.  (In the glibc sysdeps/posix/spawni.c file you pointed to
 look around line 281, by the comment that says /* Two adjacent
 colons, or a colon at the beginning or the end of 'PATH' means to
 search the current directory.*/)

yes. Empty path element stands for the current working directory e.g.,

   $ PATH= python
   $ PATH=: python
   $ PATH=:/ python
   $ PATH=/: python

run ./python on my system.

The current working directory is intentionally excluded (in the original
and in the current patches) otherwise os.get_exec_path(env={}) would be
used.

 Note also, that glibc's spawni() uses two different default paths.
 One is for if the user didn't specify their PATH variable (that's the
 one where they use :/bin:/usr/bin) and a completely different (built
 in path is used in the spawn*p* version) if it turns out that the file
 is a script that needs to run under the system sh.  (On line 290 they
 call maybe_script_execute(), which calls script_execute(), which uses
 _PATH_BSHELL.)

glibc hardcodes the path (like subprocess module does currently):

  #define   _PATH_BSHELL/bin/sh

os.get_shell_executable() is an enhancement that allows
(Unix) systems to configure the path via os.defpath.

 But os.defpath doesn't work on Android either (because it is hardcoded
 to ':/bin:/usr/bin').

As I've mentioned in msg224514 before posting my original patch:

- Andriod uses /system/bin/sh
- os.defpath could be tweaked on Android

i.e., yes. Default os.defpath doesn't work there and it should be
configured on Android to include the path to the standard shell.

--

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



[issue16353] add function to os module for getting path to default shell

2014-11-06 Thread Akira Li

Changes by Akira Li 4kir4...@gmail.com:


Added file: http://bugs.python.org/file37140/os.get_shell_executable-3.patch

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



[issue22807] uuid.uuid1() should use uuid_generate_time_safe() if available

2014-11-06 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On Nov 06, 2014, at 08:10 PM, Alex Gaynor wrote:

FWIW, I'm not convinced the pure python fallback code is sufficient either;
time.time() doesn't have the necessary resolution AFAIK? Also clock_seq is
generated using the random module's messerne twister, not SystemRandom().

Perhaps, but that's a different bug. ;)

-snip snip-
from uuid import UUID
import ctypes
import ctypes.util

lib = ctypes.CDLL(ctypes.util.find_library('uuid'))
_ugts = lib.uuid_generate_time_safe

_buffer = ctypes.create_string_buffer(16)
retval = _ugts(_buffer)

# Remember, this is C!
is_safe = (retval == 0)

print('{} is safe? {}'.format(UUID(bytes=_buffer.raw), is_safe))
-snip snip-

On Ubuntu 14.10, gives me:

---- is safe? True

--

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



[issue20160] broken ctypes calling convention on MSVC / 64-bit Windows (large structs)

2014-11-06 Thread Steve Dower

Steve Dower added the comment:

Upstream as in libffi? I'm fairly sure they've fixed it already, but their 
current code bears little relation to what we have, so it's not easy to tell 
and I didn't look all that closely.

Who's doing the forwarding?

--

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



[issue22808] Typo in asyncio-eventloop.rst, time() link is wrong

2014-11-06 Thread Mark Grandi

New submission from Mark Grandi:

In the asyncio documentation, specifically asyncio-eventloop.rst, in the 
description for BaseEventLoop.call_at(), it has:

   Arrange for the *callback* to be called at the given absolute timestamp 
*when* (an int or float), using the same time reference as :meth:`time`.

This links to the time module's time.time() method, which is incorrect as well 
as confusing, as the event loop's clock is NOT the same as time.time(), and it 
even says so on the top of the 'delayed calls' section

According the python documentation guide, it should have a period before it to 
make it refer to a method that is within the same module. I however decided to 
change it to `BaseEventLoop.time()`, because when i  see the text 'time()', 
even if it links to the right method, still makes me think of time.time(), 
which is again confusing and generally incorrect. 

Attached is a patch file, its a trivial change, but i did regenerate the docs 
and confirmed that it works, and clicking the link takes you to the right 
method in the page.

--
assignee: docs@python
components: Documentation
files: markgrandi_asyncio-eventloop.rst.patch
keywords: patch
messages: 230764
nosy: docs@python, markgrandi
priority: normal
severity: normal
status: open
title: Typo in asyncio-eventloop.rst, time() link is wrong
type: enhancement
versions: Python 3.4
Added file: 
http://bugs.python.org/file37141/markgrandi_asyncio-eventloop.rst.patch

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



[issue22809] Include/graminit.h and Python/graminit.c always rebuilt (breaks cross builds)

2014-11-06 Thread Matt Frank

New submission from Matt Frank:

changeset 92496:c2a53aa27cad (issue22359) broke cross builds.  (Now make 
touch; make always tries to rebuild Include/graminit.h and Python/graminit.c 
by running pgen.  But pgen is a host executable and won't run on the build 
machine during a cross-build.)

I think the problem is here, around Makefile.pre.in line 750.  The dependency 
was on PGENSRCS and is now on PGEN.  Will changing it back to PGENSRCS break 
something else?

@@ -745,15 +746,13 @@
 
 $(IO_OBJS): $(IO_H)
 
-$(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGENSRCS)
+$(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGEN)

--
components: Build, Cross-Build
messages: 230765
nosy: WanderingLogic
priority: normal
severity: normal
status: open
title: Include/graminit.h and Python/graminit.c always rebuilt (breaks cross 
builds)
versions: Python 3.5

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



[issue22359] Remove incorrect uses of recursive make

2014-11-06 Thread Matt Frank

Matt Frank added the comment:

Sorry, I'm complaining.  Cross builds broke.  Please see issue22809.

--
nosy: +WanderingLogic

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



[issue22786] Message could not be delivered

2014-11-06 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
resolution:  - not a bug
stage:  - resolved
status: open - closed

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



[issue22809] Include/graminit.h and Python/graminit.c always rebuilt (breaks cross builds)

2014-11-06 Thread Georg Brandl

Georg Brandl added the comment:

Duplicate of #22625.

--
nosy: +georg.brandl
resolution:  - duplicate
status: open - closed
superseder:  - When cross-compiling, don’t try to execute binaries

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



[issue22636] avoid using a shell in ctypes.util: replace os.popen with subprocess

2014-11-06 Thread Barry A. Warsaw

Changes by Barry A. Warsaw ba...@python.org:


--
nosy: +barry

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



[issue22810] tkinter: alloc: invalid block: after askopenfilename

2014-11-06 Thread lccat

New submission from lccat:

After running the Tkinter file dialog ( tkinter.filedialog.askopenfilename() ), 
and closing the tkinter window the following error message is displayed:
alloc: invalid block: 0xb035e0: b0 0
To reproduce see the attached python script tktest. This does not stop the 
program as far as i can see.  Also happens for the directory selector.
Platform is linux.

--
components: Tkinter
files: tktest.py
messages: 230768
nosy: lccat
priority: normal
severity: normal
status: open
title: tkinter:  alloc: invalid block: after askopenfilename
versions: Python 3.4
Added file: http://bugs.python.org/file37142/tktest.py

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



[issue22808] Typo in asyncio-eventloop.rst, time() link is wrong

2014-11-06 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
components: +asyncio
nosy: +gvanrossum, haypo, yselivanov
stage:  - patch review
versions: +Python 3.5

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



[issue22808] Typo in asyncio-eventloop.rst, time() link is wrong

2014-11-06 Thread Guido van Rossum

Guido van Rossum added the comment:

LG, can someone commit this? Should be backported to the 3.4 docs as well.

--

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



[issue22807] uuid.uuid1() should use uuid_generate_time_safe() if available

2014-11-06 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +haypo

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



[issue22811] _top_level_dir state leaks on defaultTestLoader

2014-11-06 Thread Robert Collins

New submission from Robert Collins:

TestProgram uses defaultTestLoader to load tests. Calling discover() on a 
TestLoader sets _top_level_dir. Calling discover with no top_level_dir 
implictly sets _top_level_dir but only the first time: the second time it is 
called with a different start_dir the prior one is used.

This leads to errors like:
==
ERROR: test_run_list_failed_import (testtools.tests.test_run.TestRun)
testtools.tests.test_run.TestRun.test_run_list_failed_import
--
_StringException: Traceback (most recent call last):
  File /home/robertc/personal/testtools/testtools/tests/test_run.py, line 
175, in test_run_list_failed_import
run.main, ['prog', 'discover', '-l', broken.package.base, '*.py'], out)
  File /home/robertc/personal/testtools/testtools/testcase.py, line 420, in 
assertRaises
self.assertThat(our_callable, matcher)
  File /home/robertc/personal/testtools/testtools/testcase.py, line 431, in 
assertThat
mismatch_error = self._matchHelper(matchee, matcher, message, verbose)
  File /home/robertc/personal/testtools/testtools/testcase.py, line 481, in 
_matchHelper
mismatch = matcher.match(matchee)
  File /home/robertc/personal/testtools/testtools/matchers/_exception.py, 
line 108, in match
mismatch = self.exception_matcher.match(exc_info)
  File /home/robertc/personal/testtools/testtools/matchers/_higherorder.py, 
line 62, in match
mismatch = matcher.match(matchee)
  File /home/robertc/personal/testtools/testtools/testcase.py, line 412, in 
match
reraise(*matchee)
  File /home/robertc/personal/testtools/testtools/matchers/_exception.py, 
line 101, in match
result = matchee()
  File /home/robertc/personal/testtools/testtools/testcase.py, line 965, in 
__call__
return self._callable_object(*self._args, **self._kwargs)
  File /home/robertc/personal/testtools/testtools/run.py, line 413, in main
stdout=stdout)
  File /home/robertc/personal/testtools/testtools/run.py, line 208, in 
__init__
self.parseArgs(argv)
  File /home/robertc/personal/testtools/testtools/run.py, line 252, in 
parseArgs
self._do_discovery(argv[2:])
  File /home/robertc/personal/testtools/testtools/run.py, line 368, in 
_do_discovery
loaded = loader.discover(self.start, self.pattern, self.top)
  File 
/home/robertc/.virtualenvs/testtools-2.7/local/lib/python2.7/site-packages/unittest2/loader.py,
 line 353, in discover
raise ImportError('Start directory is not importable: %r' % start_dir)
ImportError: Start directory is not importable: '/tmp/tmpac4uwI'


When a test tries to test the behaviour of TestProgram (or a subclass thereof).

The fix is straight forward: at the end of discover restore the value of 
_top_level_dir that it had at entry.

--
messages: 230770
nosy: rbcollins
priority: normal
severity: normal
status: open
title: _top_level_dir state leaks on defaultTestLoader

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



[issue22811] _top_level_dir state leaks on defaultTestLoader

2014-11-06 Thread Robert Collins

Changes by Robert Collins robe...@robertcollins.net:


--
components: +Library (Lib)
versions: +Python 3.5

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