[issue19921] Path.mkdir(0, True) always fails

2013-12-08 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Fails on Windows Vista.

...s..s..s..s...F.
..
==
FAIL: test_mkdir_parents (__main__.PathTest)
--
Traceback (most recent call last):
  File Lib\test\test_pathlib.py, line 1502, in test_mkdir_parents
self.assertEqual(stat.S_IMODE(p.stat().st_mode), 0o555  mode)
AssertionError: 511 != 365

==
FAIL: test_mkdir_parents (__main__.WindowsPathTest)
--
Traceback (most recent call last):
  File Lib\test\test_pathlib.py, line 1502, in test_mkdir_parents
self.assertEqual(stat.S_IMODE(p.stat().st_mode), 0o555  mode)
AssertionError: 511 != 365

--
Ran 326 tests in 3.293s

FAILED (failures=2, skipped=90)

This line is problematic.
self.assertEqual(stat.S_IMODE(p.stat().st_mode), 0o555  mode)

From http://docs.python.org/2/library/os.html#os.chmod:

Note
Although Windows supports chmod(), you can only set the file’s read-only flag 
with it (via the stat.S_IWRITE and stat.S_IREAD constants or a corresponding 
integer value). All other bits are ignored.

In Django, we skip chmod test on Windows.
https://github.com/django/django/blob/master/tests/staticfiles_tests/tests.py#L830

But this line is okay:
self.assertEqual(stat.S_IMODE(p.parent.stat().st_mode), mode)

So we should just skip that particular problematic line on Windows.

--
nosy: +vajrasky

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



[issue19928] Implement cell repr test

2013-12-08 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Repr test for cell is empty. Proposed patch implements it.

--
components: Tests
files: test_cell_repr.patch
keywords: patch
messages: 205528
nosy: serhiy.storchaka, zach.ware
priority: normal
severity: normal
stage: patch review
status: open
title: Implement cell repr test
type: enhancement
versions: Python 2.7, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file33039/test_cell_repr.patch

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



[issue19876] selectors (and asyncio?): document behaviour on closed files/sockets

2013-12-08 Thread Charles-François Natali

Charles-François Natali added the comment:

The test is failing on Windows buildbot:
http://buildbot.python.org/all/builders/x86%20Windows%20Server%202003%20%5BSB%5D%203.x/builds/1851/steps/test/logs/stdio

==
ERROR: test_unregister_after_fd_close_and_reuse 
(test.test_selectors.DefaultSelectorTestCase)
--
Traceback (most recent call last):
  File 
E:\Data\buildslave\cpython\3.x.snakebite-win2k3r2sp2-x86\build\lib\test\test_selectors.py,
 line 122, in test_unregister_after_fd_close_and_reuse
os.dup2(rd2.fileno(), r)
OSError: [Errno 9] Bad file descriptor

==
ERROR: test_unregister_after_fd_close_and_reuse 
(test.test_selectors.SelectSelectorTestCase)
--
Traceback (most recent call last):
  File 
E:\Data\buildslave\cpython\3.x.snakebite-win2k3r2sp2-x86\build\lib\test\test_selectors.py,
 line 122, in test_unregister_after_fd_close_and_reuse
os.dup2(rd2.fileno(), r)
OSError: [Errno 9] Bad file descriptor


Apparently, dup2() doesn't work on Windows because on Windows, sockets aren't 
file descriptors, but a different beast...

--
status: closed - open

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



[issue19837] Wire protocol encoding for the JSON module

2013-12-08 Thread Gregory P. Smith

Gregory P. Smith added the comment:

upstream simplejson (of which json is an earlier snapshot of) has an encoding 
parameter on its dump and dumps method.  Lets NOT break compatibility with that 
API.

Our users use these modules interchangeably today, upgrading from stdlib json 
to simplejson when they need more features or speed without having to change 
their code.

simplejson's dumps(encoding=) parameter tells the module what encoding to 
decode bytes objects found within the data structure as (whereas Python 3.3's 
builtin json module being older doesn't even support that use case and raises a 
TypeError when bytes are encountered within the structure being serialized).

http://simplejson.readthedocs.org/en/latest/

A json.dump_bytes() function implemented as:

def dump_bytes(*args, **kwargs):
  return dumps(*args, **kwargs).encode('utf-8')

makes some sense.. but it is really trivial for anyone to write that 
.encode(...) themselves.

a dump_bytes_to_file method that acts like dump() and calls .encode('utf-8') on 
all str's before passing them to the write call is also doable... but it seems 
easier to just let people use an existing io wrapper to do that for them as 
they already are.

As for load/loads, it is easy to allow that to accept bytes as input and assume 
it comes utf-8 encoded.  simplejson already does this.  json does not.

--
nosy: +gregory.p.smith

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



[issue19925] Add unit test for spwd module

2013-12-08 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Hi Claudiu, thanks for the review and the knowledge that on Windows, we don't 
have attribute getuid of os. Here is the updated patch. I do not check 
specifically for Windows but only whether the platform can import spwd module 
or not. That should be enough.

--
Added file: http://bugs.python.org/file33040/unittest_for_spwd_v2.patch

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



[issue19837] Wire protocol encoding for the JSON module

2013-12-08 Thread Gregory P. Smith

Gregory P. Smith added the comment:

So why not put a dump_bytes into upstream simplejson first, then pull in a 
modern simplejson?

There might be some default flag values pertaining to new features that need 
changing for stdlib backwards compatible behavior but otherwise I expect it's a 
good idea.

--

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



[issue19572] Report more silently skipped tests as skipped

2013-12-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I have added few comments on Rietveld.

--

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



[issue19929] subprocess: increase read buffer size

2013-12-08 Thread Charles-François Natali

New submission from Charles-François Natali:

This is a spinoff of issue #19506: currently, subprocess.communicate() uses a 
4K buffer when reading data from pipes.
This was probably optimal a couple years ago, but nowadays most operating 
systems have larger pipes (e.g. Linux has 64K), so we might be able to gain 
some performance by increasing this buffer size.

For example, here's a benchmark reading from a subprocess spawning dd 
if=/dev/zero bs=1M count=100:

# before, 4K buffer
$ ./python ~/test_sub_read.py 
2.72450800300021

# after, 64K buffer
$ ./python ~/test_sub_read.py 
1.250900044803

The difference is impressive.

I'm attaching the benchmark script so that others can experiment a bit (on 
multi-core machines and also different OSes).

--
components: Library (Lib)
files: test_sub_read.py
messages: 205534
nosy: gregory.p.smith, haypo, neologix, pitrou, sbt, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: subprocess: increase read buffer size
type: performance
versions: Python 3.4
Added file: http://bugs.python.org/file33041/test_sub_read.py

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



[issue19766] test_venv: test_with_pip() failed on AMD64 Fedora without threads 3.x buildbot: urllib3 dependency requires the threading module

2013-12-08 Thread Vinay Sajip

Vinay Sajip added the comment:

I will look at doing a distlib update shortly - but there's another issue 
(#19913) that might also require an update - it' not clear yet.

--

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



[issue19690] test_logging test_race failed with PermissionError

2013-12-08 Thread Vinay Sajip

Vinay Sajip added the comment:

I'll close this for now as the failures seem to have stopped. Though I only 
added some diagnostics, that might have changed the relative timings enough so 
the race doesn't surface (for now).

--
resolution:  - works for me
status: open - closed

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



[issue19921] Path.mkdir(0, True) always fails

2013-12-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Vajrasky. Now this check is skipped on Windows.

--
Added file: http://bugs.python.org/file33042/pathlib_mkdir_mode_4.patch

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



[issue19846] print() and write() are relying on sys.getfilesystemencoding() instead of sys.getdefaultencoding()

2013-12-08 Thread STINNER Victor

STINNER Victor added the comment:

Antoine Pitrou added the comment:
  Python uses the fact that the filesystem encoding is the locale
  encoding in various places.
 The patch doesn't change that.

Nick Coghlan added the comment:
 Note that the *only* change Antoine's patch makes is that:
 - *if* the locale encoding is ASCII (or an alias for ASCII)
 - *then* Python sets the filesystem encoding to UTF-8 instead

If the locale encoding is ASCII, filesystem encoding (UTF-8) is
different than the locale encoding.

--

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



[issue19929] subprocess: increase read buffer size

2013-12-08 Thread STINNER Victor

STINNER Victor added the comment:

Where is the buffer size? The hardcoded 4096 value in Popen._communicate()?
   data = os.read(key.fd, 4096)

I remember that I asked you where does 4096 come from when you patched 
subprocess to use selectors (#18923):
http://bugs.python.org/review/18923/#ps9827

Python 3.3 uses 1024 for its select.select() implementation, 4096 for its 
select.poll() implementation.

Since Popen.communicate() returns the whole content of the buffer, would it be 
safe to increase the buffer size? For example, use 4 GB as the buffer size? 
Should communicate() be fair between stdout and stderr?

To choose a new value, we need benchmark results on different OSes, at least 
Windows, Linux, FreeBSD (and maybe also Solaris) since these 3 OSes have a 
different kernel.

--

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



[issue19929] subprocess: increase read buffer size

2013-12-08 Thread STINNER Victor

STINNER Victor added the comment:

Oh, Charles-François Natali replied to my review by email, and it's not 
archived on Rietveld. Copy of him message:

 http://bugs.python.org/review/18923/diff/9757/Lib/subprocess.py#newcode420
 Lib/subprocess.py:420: _PopenSelector = selectors.SelectSelector
 This code should be factorized, but I opened a new issue for that:
 #19465.
 http://bugs.python.org/issue19465

OK, so we'll see in the other issue :-)

 http://bugs.python.org/review/18923/diff/9757/Lib/subprocess.py#newcode1583
 Lib/subprocess.py:1583: self._input_offset + _PIPE_BUF]
 (Unrelated to the selector issue) It may be more efficient to use a
 memory view instead of a slice here.

I also noticed, but that's also a different issue.

 http://bugs.python.org/review/18923/diff/9757/Lib/subprocess.py#newcode1597
 Lib/subprocess.py:1597: data = os.read(key.fd, 4096)
 In the old code, poll() uses 4096 whereas select() uses 1024 bytes... Do
 you know the reason? Why 4096 and not 1 byte or 1 MB? I would prefer a
 global constant rather than an harded limit.

When writing to the pipe, we should definitely write less than
PIPE_BUF, to avoid blocking after select()/poll() returns write-ready.
When reading, it's not so important, in the sense that any value will work.
The only difference will be a difference speed.

Logically, I would say that the ideal size is the pipe buffer size,
which varies between 4K and 64K: and indeed, I wrote a quick
benchmark, and a 64K value yields the best result.

 Use maybe os.stat(fd).st_blksize?

IMO that's not worth it, also, IIRC, some OS don't set it for pipes.

 Modules/_io/fileio.c uses SMALLCHUNK to read the whole content of a
 file:

 #if BUFSIZ  (8*1024)
 #define SMALLCHUNK (8*1024)
 #elif (BUFSIZ = (2  25))
 #error unreasonable BUFSIZ  64MB defined
 #else
 #define SMALLCHUNK BUFSIZ
 #endif

 The io module uses a default buffer size of 8 KB to read.

Well, that's just a heuristic: the ideal size depends on the OS, the
filesystem, backing device, etc (for an on-disk file)?

Anyway, this too belongs to another issue.

Please try to only make comments relevant to the issue at hand!

 http://bugs.python.org/review/18923/diff/9757/Lib/test/test_subprocess.py
 File Lib/test/test_subprocess.py (left):

 http://bugs.python.org/review/18923/diff/9757/Lib/test/test_subprocess.py#oldcode2191
 Lib/test/test_subprocess.py:2191: class
 ProcessTestCaseNoPoll(ProcessTestCase):
 Oh oh, removing a test is not a good idea. You should test select and
 poll selectors when poll is used by default.

Well, those distinct test cases made sense before, because there were
two different code paths depending on whether we were using select()
or poll(). Now, the code path is exactly the same, and the different
selectors implementations have their own tests, so IMO that's not
necessary anymore.

But I re-enabled them anyway...

--

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



[issue17259] Document round half to even rule for floats

2013-12-08 Thread alexd2

alexd2 added the comment:

I encountered the same inconsistent behavior. That is, I don't get the same 
rounding from the two following commands:

print %.f %.f %(0.5, 1.5)   # Gives -- 0 2
print %.f %.f %(round(0.5), round(1.5)) # Gives -- 1 2

I also get:
print round(0.5), round(1.5) # Gives -- 1.0 2.0

From what I read in the thread it seems to be more like a bug rather than 
something to just be documented, right?

--
nosy: +alexd2

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



[issue19766] test_venv: test_with_pip() failed on AMD64 Fedora without threads 3.x buildbot: urllib3 dependency requires the threading module

2013-12-08 Thread Vinay Sajip

Vinay Sajip added the comment:

I've updated distlib to use dummy_threading where threading isn't available - 
see

https://bitbucket.org/pypa/distlib/commits/029fee573900765729402203e39b2171d7ae0784

Can someone please test with this version vendored into pip to check that the 
failures no longer occur in a no-thread environment, before I do a distlib 
release?

--

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



[issue19930] os.makedirs('dir1/dir2', 0) always fails

2013-12-08 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

os.makedirs() can't create a directory with cleared write or list permission 
bits for owner when parent directories aren't created. This is because for 
parent directories same mode is used as for final directory.

Note that the mkdir utility creates parent directories with default mode (0o777 
 ~umask).

$ mkdir -p -m 0 t1/t2/t3
$ ls -l -d t1 t1/t2 t1/t2/t3
drwxrwxr-x 3 serhiy serhiy 4096 Dec  7 22:30 t1/
drwxrwxr-x 3 serhiy serhiy 4096 Dec  7 22:30 t1/t2/
d- 2 serhiy serhiy 4096 Dec  7 22:30 t1/t2/t3/

The proposed patch emulates the mkdir utility.

See also issue19921.

--
components: Library (Lib)
messages: 205543
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: os.makedirs('dir1/dir2', 0) always fails
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4

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



[issue19930] os.makedirs('dir1/dir2', 0) always fails

2013-12-08 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
keywords: +patch
nosy: +loewis
Added file: http://bugs.python.org/file33043/os_makedirs_mode.patch

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



[issue19883] Integer overflow in zipimport.c

2013-12-08 Thread STINNER Victor

STINNER Victor added the comment:

Here is a work-in-progress patch.

PyMarshal_ReadShortFromFile() and PyMarshal_ReadLongFromFile() are still wrong: 
new Unsigned version should be added to marshal.c. I don't know if a C cast to 
unsigned is enough because long can be larger than 32-bit (ex: on Linux 64-bit):
#if SIZEOF_LONG  4
/* Sign extension for 64-bit machines */
x |= -(x  0x8000L);
#endif

I didn't test my patch. Anyone interested to finish the patch?

--
Added file: http://bugs.python.org/file33044/zipimport_int_overflow.patch

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



[issue19846] print() and write() are relying on sys.getfilesystemencoding() instead of sys.getdefaultencoding()

2013-12-08 Thread Nick Coghlan

Nick Coghlan added the comment:

Yes, that's the point. *Every* case I've seen where the locale encoding has 
been reported as ASCII on a modern Linux system has been because the 
environment has been configured to use the C locale, and that locale has a 
silly, antiquated, encoding setting.

This is particularly problematic when people remotely access a system with ssh 
and get given the C locale instead of something sensible, and then can't 
properly read the filesystem on that server.

The idea of using UTF-8 instead in that case is to *change* (and hopefully 
reduce) the number of cases where things go wrong.

- if no non-ASCII data is encountered, the choice of ASCII vs UTF-8 doesn't 
matter
- if it's a modern Linux distro, then the real filesystem encoding is UTF-8, 
and the setting it provides for LANG=C is just plain *wrong*
- there may be other cases where ASCII actually *is* the filesystem encoding 
(in which case they're going to have trouble anyway), or the real filesystem 
encoding is something other than UTF-8

We're already approximating things on Linux by assuming every filesystem is 
using the *same* encoding, when that's not necessarily the case. Glib 
applications also assume UTF-8, regardless of the locale 
(http://unix.stackexchange.com/questions/2089/what-charset-encoding-is-used-for-filenames-and-paths-on-linux).

At the moment, setting LANG=C on a Linux system *fundamentally breaks Python 
3*, and that's not OK.

--

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



[issue19846] Setting LANG=C breaks Python 3

2013-12-08 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


--
title: print() and write() are relying on sys.getfilesystemencoding() instead 
of sys.getdefaultencoding() - Setting LANG=C breaks Python 3

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



[issue19876] selectors (and asyncio?): document behaviour on closed files/sockets

2013-12-08 Thread STINNER Victor

STINNER Victor added the comment:

I don't like generic except OSError: pass. Here is a first patch for epoll() 
to use except FileNotFoundError: pass instead. Kqueue selector should also be 
patched.

I tested to close epoll FD (os.close(epoll.fileno())): on Linux 3.11, 
epoll.unregister(fd) and epoll.close() don't raise an error. Strange. (The C 
code looks correct).

(About the commit: I don't like _fileobj_lookup method name, we loose the 
information (compared to _fileobj_to_fd name) that the method returns a file 
dscriptor. I would prefer _get_fd or _get_fileobj_fd.)

--
resolution: fixed - 
Added file: http://bugs.python.org/file33045/epoll_except.patch

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



[issue19846] print() and write() are relying on sys.getfilesystemencoding() instead of sys.getdefaultencoding()

2013-12-08 Thread STINNER Victor

STINNER Victor added the comment:

2013/12/8 Nick Coghlan rep...@bugs.python.org:
 Yes, that's the point. *Every* case I've seen where the locale encoding has 
 been reported as ASCII on a modern Linux system has been because the 
 environment has been configured to use the C locale, and that locale has a 
 silly, antiquated, encoding setting.

 This is particularly problematic when people remotely access a system with 
 ssh and get given the C locale instead of something sensible, and then can't 
 properly read the filesystem on that server.

The solution is to fix the locale, not to fix Python. For example,
don't set LANG to C.

From the C locale, you cannot guess the correct encoding. In
Unicode, the general rule is to never try the encoding.

 The idea of using UTF-8 instead in that case is to *change* (and hopefully 
 reduce) the number of cases where things go wrong.

If the OS uses ISO-8859-1, forcing Python (filesystem) encoding to
UTF-8 would produce invalid filenames, display mojibake and more
generally produce data incompatible with other applicatons (who rely
on the C locale, and so the ASCII encoding).

 - there may be other cases where ASCII actually *is* the filesystem encoding 
 (in which case they're going to have trouble anyway), or the real filesystem 
 encoding is something other than UTF-8

As I wrote before, os.getfilesystemencoding() is *not* the filesystem
encoding. It's the OS encoding used to decode any kind of data
coming for the OS and used to encode back Python data to the OS. Just
some examples:

- DNS hostnames
- Environment variables
- Command line arguments
- Filenames
- user/group entries in the grp/pwd modules
- almost all functions of the os module, they return various type of
information (ttyname, ctermid, current working directory, login, ...)

 We're already approximating things on Linux by assuming every filesystem is 
 using the *same* encoding, when that's not necessarily the case. Glib 
 applications also assume UTF-8, regardless of the locale 
 (http://unix.stackexchange.com/questions/2089/what-charset-encoding-is-used-for-filenames-and-paths-on-linux).

If you use a different encoding but only just for filenames, you will
get mojibake when you pass a filename on the command line or in an
environment varialble.

 At the moment, setting LANG=C on a Linux system *fundamentally breaks 
 Python 3*, and that's not OK.

Getting ASCII filesystem encoding is annoying, but I would not say
that it fundamentally breaks Python 3. If you want to do something,
you should write documentation explaining how to configure properly
Linux.

--
title: Setting LANG=C breaks Python 3 - print() and write() are relying on 
sys.getfilesystemencoding() instead of sys.getdefaultencoding()

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



[issue19846] print() and write() are relying on sys.getfilesystemencoding() instead of sys.getdefaultencoding()

2013-12-08 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 If you use a different encoding but only just for filenames, you will
 get mojibake when you pass a filename on the command line or in an
 environment varialble.

That's not what the patch does.

--

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



[issue19700] Update runpy for PEP 451

2013-12-08 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


--
assignee:  - ncoghlan

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



[issue19846] print() and write() are relying on sys.getfilesystemencoding() instead of sys.getdefaultencoding()

2013-12-08 Thread STINNER Victor

STINNER Victor added the comment:

2013/12/8 Antoine Pitrou rep...@bugs.python.org:
 Python uses the fact that the filesystem encoding is the locale
 encoding in various places.

 The patch doesn't change that.

You wrote: - With the patch: utf-8 utf-8 utf-8 ANSI_X3.4-1968, so
os.get sys.getfilesystemencoding() != locale.getpreferredencoding().
Or said differently, the filesystem encoding is different than the
locale encoding.

So please read again my following message which list real bugs:
https://mail.python.org/pipermail/python-dev/2010-October/104509.html

If you want to use a filesystem encoding different than the locale
encoding, you have to patch Python where Python assumes that the
filesystem encoding is the locale encoding, to fix all these bugs.
Starts with:

- PyUnicode_DecodeFSDefaultAndSize()
- PyUnicode_EncodeFSDefault()
- _Py_wchar2char()
- _Py_char2wchar()

It should be easier to change this function if the FS != locale only
occurs when FS is UTF-8. On Mac OS X, Python always use UTF-8 for
the filesystem encoding, it doesn't care of the locale encoding. See
_Py_DecodeUTF8_surrogateescape() in unicodeobject.c, you may reuse it.

With a better patch, I can do more experiment to check if they are
other tricky bugs.

Does at least your patch pass the whole test suite with LANG=C?

--

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



[issue19846] print() and write() are relying on sys.getfilesystemencoding() instead of sys.getdefaultencoding()

2013-12-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Setting sys.stderr encoding to UTF-8 on ASCII locale is wrong. sys.stderr has 
the backslashreplace error handler by default, so it newer fails and should 
newer produce non-ASCII data on ASCII locale.

--
nosy: +serhiy.storchaka

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



[issue19876] selectors (and asyncio?): document behaviour on closed files/sockets

2013-12-08 Thread Charles-François Natali

Charles-François Natali added the comment:

 STINNER Victor added the comment:

 I don't like generic except OSError: pass. Here is a first patch for 
 epoll() to use except FileNotFoundError: pass instead. Kqueue selector 
 should also be patched.

Except that it can fail with ENOENT, but also EBADF, and EPERM if the
FD has been reused by a FD which doesn't support epoll.
So if we want to go this way, we should at least catach ENOENT, EBADF
and EPERM. Same for kqueue: we should at least catch ENOENT and EBADF.

 I tested to close epoll FD (os.close(epoll.fileno())): on Linux 3.11, 
 epoll.unregister(fd) and epoll.close() don't raise an error. Strange. (The C 
 code looks correct).

unregister() ignores EBADF.

 (About the commit: I don't like _fileobj_lookup method name, we loose the 
 information (compared to _fileobj_to_fd name) that the method returns a 
 file dscriptor. I would prefer _get_fd or _get_fileobj_fd.)

Well, Guido likes it, I like it, and this is really nit-picking
(especially since it's a private method).

--

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



[issue19929] subprocess: increase read buffer size

2013-12-08 Thread Charles-François Natali

Charles-François Natali added the comment:

 STINNER Victor added the comment:

 Since Popen.communicate() returns the whole content of the buffer, would it 
 be safe to increase the buffer size? For example, use 4 GB as the buffer size?

Sure, if you want to pay the CPU and memory overhead of allocating a
4GB buffer :-)

 Should communicate() be fair between stdout and stderr?

There's no reason to make the buffer depend on the FD.

 To choose a new value, we need benchmark results on different OSes, at least 
 Windows, Linux, FreeBSD (and maybe also Solaris) since these 3 OSes have a 
 different kernel.

Windows isn't concerned by this, since it doesn't use a selector, but threads.
For the other OSes, that's why I opened this issue (you forgot AIX in
your list :-).

--

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



[issue19927] Path-based loaders lack a meaningful __eq__() implementation.

2013-12-08 Thread Larry Hastings

Larry Hastings added the comment:

Brett, could you weigh in please?

--

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



[issue19846] print() and write() are relying on sys.getfilesystemencoding() instead of sys.getdefaultencoding()

2013-12-08 Thread Larry Hastings

Larry Hastings added the comment:

Antoine: are you characterizing this as a bug rather than a new feature?

I'd like to see more of a consensus before something like this gets checked in. 
 Right now I see a variety of opinions.

When I think conservative approach and knows about system encoding stuff, I 
think of Martin.  Martin, can I ask you to form an opinion about this?

--

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



[issue19846] print() and write() are relying on sys.getfilesystemencoding() instead of sys.getdefaultencoding()

2013-12-08 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Or said differently, the filesystem encoding is different than the
 locale encoding.

Indeed, but the FS encoding and the IO encoding are the same.
locale encoding doesn't really matter here, as we are assuming that it's 
wrong.

--

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



[issue19700] Update runpy for PEP 451

2013-12-08 Thread Nick Coghlan

Nick Coghlan added the comment:

OK, I just noticed that importlib.find_spec copies the annoying-as-hell 
behaviour of importlib.find_loader where it doesn't work with dotted names. Can 
we fix that please? It's stupid that pkgutil.get_loader has to exist to 
workaround that design flaw for find_loader, and I'd hate to see it replicated 
in a new public facing API.

--

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



[issue19766] test_venv: test_with_pip() failed on AMD64 Fedora without threads 3.x buildbot: urllib3 dependency requires the threading module

2013-12-08 Thread Christian Heimes

Christian Heimes added the comment:

Vinay, thanks for your fast response! :) #19913 should be resolved, too. A 
couple of months ago several people complained about a new file that looked 
like a ZIP bomb. This virus warnings looks even more severe although it's 
probably a false positive. Could you try a new set of binaries without UPX? 
https://www.virustotal.com/ lets you scan the files with more than 40 programs 
at once and for free.

--

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



[issue19343] Expose FreeBSD-specific APIs in resource module

2013-12-08 Thread Larry Hastings

Larry Hastings added the comment:

I can live with this in 3.4 if you check it in before beta 2.

--

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



[issue17259] Document round half to even rule for floats

2013-12-08 Thread alexd2

alexd2 added the comment:

Note:
I have python2.7.3 in Ubuntu 12.04.3 installed in a VirtualBox VM on a Windows 
7 32-bit and an Intel(R) Core(TM)2 Duo CPU U9300 @ 1.20GHz (2 CPUs), ~1.2GHz 
processor

--

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



[issue19343] Expose FreeBSD-specific APIs in resource module

2013-12-08 Thread Christian Heimes

Christian Heimes added the comment:

Thanks Larry!

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

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



[issue19343] Expose FreeBSD-specific APIs in resource module

2013-12-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ad2cd599f1cf by Christian Heimes in branch 'default':
Issue #19343: Expose FreeBSD-specific APIs in resource module.  Original patch 
by Koobs.
http://hg.python.org/cpython/rev/ad2cd599f1cf

--
nosy: +python-dev

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



[issue19343] Expose FreeBSD-specific APIs in resource module

2013-12-08 Thread Christian Heimes

Christian Heimes added the comment:

Claudiu, I'm really sorry. :( The patch was originally developed by you, not by 
koobs. All credits to you!

--

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



[issue19700] Update runpy for PEP 451

2013-12-08 Thread Nick Coghlan

Nick Coghlan added the comment:

Deleted a bunch of code, and runpy now correctly sets both __file__ and 
__cached__ (runpy previously never set the latter properly).

You can also see the reason for my rant above in the form of 
runpy._fixed_find_spec. importlib.find_loader was always kind of useless in end 
user code that needed to handle arbitrary modules, you needed to use the 
pkgutil.get_loader wrapper instead. It would be nice if importlib.find_spec 
just worked, instead of only working for top level modules. At the very 
least, it should fail noisily if a dotted name is passed in without specifying 
a path argument.

I may have argued in favour of the side effect free find_loader in the past, if 
I have, consider this me admitting I was wrong after wasting a bunch of time 
hunting down unexpected import errors in test_runpy after the initial 
conversion to using find_spec.

There's one final change needed to address the pickle-in-main compatibility 
issue: runpy has to alias the module under its real name as well as __main__. 
Once it does that, then using __spec__.name (when available) should ensure 
pickle does the right thing.

--
keywords: +patch
Added file: http://bugs.python.org/file33046/issue19700_runpy_spec.diff

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



[issue19846] print() and write() are relying on sys.getfilesystemencoding() instead of sys.getdefaultencoding()

2013-12-08 Thread Nick Coghlan

Nick Coghlan added the comment:

Victor, people set LANG=C for all sorts of reasons, and we have no
control over how operating systems define that locale. The user
perception is Python 3 doesn't work properly when you ssh into
systems, not Gee, I wish operating systems defined the C locale more
sensibly.

If you can come up with a more sensible guess than UTF-8, great, but
believing the nonsense claim of ASCII from the OS is a
not-insignificant usability issue on Linux, because it hoses *all* the
OS API interactions. Yes, theoretically, using UTF-8 can cause
problems, *if* the following all occur:

- the OS *claims* the OS encoding is ASCII (so Python uses UTF-8 instead)
- the OS encoding is *actually* something other than UTF-8
- the program encounters non-ASCII data and writes it out to disk

For fear of doing the wrong thing in that incredibly rare scenario,
you're leaving Python broken under the C locale on *every* modern
Linux distro as soon as it encounters non-ASCII data in an OS
interface.

--

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



[issue19922] mbstate_t requires _INCLUDE__STDC_A1_SOURCE

2013-12-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4221d5d9ac84 by Christian Heimes in branch 'default':
Attempt to fix OpenIndiana build issue introduced by #19922
http://hg.python.org/cpython/rev/4221d5d9ac84

--

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



[issue19736] posixmodule.c: Add flags for statvfs.f_flag to constant list

2013-12-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1d0b7e90da4d by doko in branch 'default':
- Issue #19736: Add module-level statvfs constants defined for GNU/glibc
http://hg.python.org/cpython/rev/1d0b7e90da4d

--
nosy: +python-dev

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



[issue16099] robotparser doesn't support request rate and crawl delay parameters

2013-12-08 Thread Nikolay Bogoychev

Nikolay Bogoychev added the comment:

Hey,
it has been more than an year since the last activity. 
Is there anything else I should do in order for someone of the python devs team 
to review my changes and perhaps give some feedback?

Nick

--

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



[issue11299] Allow deepcopying paused generators

2013-12-08 Thread Bastien Montagne

Changes by Bastien Montagne b.mon...@gmail.com:


--
nosy: +mont29

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



[issue19878] bz2.BZ2File.__init__() cannot be called twice with non-existent file

2013-12-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 55a748f6e396 by Nadeem Vawda in branch '2.7':
Closes #19878: Fix segfault in bz2 module.
http://hg.python.org/cpython/rev/55a748f6e396

--
nosy: +python-dev
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed

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



[issue5845] rlcompleter should be enabled automatically

2013-12-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What is the status of this issue?

--

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



[issue19930] os.makedirs('dir1/dir2', 0) always fails

2013-12-08 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Fails on Windows Vista.

==
FAIL: test_mode (__main__.MakedirTests)
--
Traceback (most recent call last):
  File Lib\test\test_os.py, line 907, in test_mode
self.assertEqual(stat.S_IMODE(os.stat(parent).st_mode), 0o775)
AssertionError: 511 != 509

--
Ran 157 tests in 1.865s

FAILED (failures=1, skipped=61)
Traceback (most recent call last):
  File Lib\test\test_os.py, line 2511, in module
test_main()
  File C:\Users\vajrasky\Code\cpython\lib\test\support\__init__.py, line 1831,
 in decorator
return func(*args)
  File Lib\test\test_os.py, line 2507, in test_main
FDInheritanceTests,
  File C:\Users\vajrasky\Code\cpython\lib\test\support\__init__.py, line 1719,
 in run_unittest
_run_suite(suite)
  File C:\Users\vajrasky\Code\cpython\lib\test\support\__init__.py, line 1694,
 in _run_suite
raise TestFailed(err)
test.support.TestFailed: Traceback (most recent call last):
  File Lib\test\test_os.py, line 907, in test_mode
self.assertEqual(stat.S_IMODE(os.stat(parent).st_mode), 0o775)
AssertionError: 511 != 509

The permission of directory on Windows no matter what mode you give or umask 
you give to support.temp_umask, is always 0o777 (or 511). I think this test 
does not make sense in Windows.

 os.mkdir('cutecat', 0o555)
 os.mkdir('cutecat2', 0o777)
 os.stat('cutecat')
os.stat_result(st_mode=16895, st_ino=3940649674207852, st_dev=3960548439, st_nli
nk=1, st_uid=0, st_gid=0, st_size=0, st_atime=1386517061, st_mtime=1386517061, s
t_ctime=1386517061)
 os.stat('cutecat2')
os.stat_result(st_mode=16895, st_ino=5066549581050708, st_dev=3960548439, st_nli
nk=1, st_uid=0, st_gid=0, st_size=0, st_atime=1386517067, st_mtime=1386517067, s
t_ctime=1386517067)

Either that, or I am missing something.

--
nosy: +vajrasky

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



[issue19099] struct.pack fails first time with unicode fmt

2013-12-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 42d3afd29460 by Serhiy Storchaka in branch '2.7':
Issue #19099: The struct module now supports Unicode format strings.
http://hg.python.org/cpython/rev/42d3afd29460

--
nosy: +python-dev

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



[issue19099] struct.pack fails first time with unicode fmt

2013-12-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Fixed. Thank you Musashi for your report.

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

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



[issue19929] subprocess: increase read buffer size

2013-12-08 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Linux, 64-bit quad core:

With 4K buffer:

$ time ./python test_sub_read.py 
0.25217683400114765

real0m0.296s
user0m0.172s
sys 0m0.183s

With 64K buffer:

$ time ./python test_sub_read.py 
0.0925754177548

real0m0.132s
user0m0.051s
sys 0m0.096s

--

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



[issue19904] Add 128-bit integer support to struct

2013-12-08 Thread Francisco Martín Brugué

Francisco Martín Brugué added the comment:

 If performance is the reason for the feature: My impression is that
 the goal of the struct module is not necessarily top performance.

I'm not sure if it applies but on #19905 (message 205345 [1])
is said its a dependency for that issue


[1] http://bugs.python.org/issue19905#msg205345

--
nosy: +francismb

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



[issue18864] Implementation for PEP 451 (importlib.machinery.ModuleSpec)

2013-12-08 Thread Brett Cannon

Brett Cannon added the comment:

Actually, ignore the __init__() part of my last comment since it's set to False 
directly.

--

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



[issue18864] Implementation for PEP 451 (importlib.machinery.ModuleSpec)

2013-12-08 Thread Brett Cannon

Brett Cannon added the comment:

(c) it is then! I would just take the time to call bool() on the arg to 
coalesce it into a True/False thing (which maybe makes sense in __init__() as 
well).

--

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



[issue19927] Path-based loaders lack a meaningful __eq__() implementation.

2013-12-08 Thread Brett Cannon

Brett Cannon added the comment:

I'm fine with the suggestions Nick made. While loaders are not technically 
immutable (and thus technically probably shouldn't define __hash__), they have 
not been defined to be mutable and mucked with anyway, so I have no issue if 
someone breaks the hash of a loader by changing an attribute post-hash.

--

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



[issue19535] Test failures with -OO

2013-12-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 910b1cb5176c by Serhiy Storchaka in branch '3.3':
Issue #19535: Fixed test_docxmlrpc when python is run with -OO.
http://hg.python.org/cpython/rev/910b1cb5176c

New changeset e71142abf8b6 by Serhiy Storchaka in branch 'default':
Issue #19535: Fixed test_docxmlrpc, test_functools, test_inspect, and
http://hg.python.org/cpython/rev/e71142abf8b6

--
nosy: +python-dev

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



[issue19535] Test failures with -OO

2013-12-08 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed
versions:  -Python 2.7

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



[issue19700] Update runpy for PEP 451

2013-12-08 Thread Brett Cannon

Brett Cannon added the comment:

Can you file a separate bug, Nick, for the importlib.find_spec() change you are 
after? I don't want to lose track of it (and I get what you are after but we 
should discuss why importlib.find_loader() was designed the way it was 
initially).

--

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



[issue19830] test_poplib emits resource warning

2013-12-08 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +haypo
stage:  - patch review

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



[issue19758] Warnings in tests

2013-12-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Christian and Eric.

--
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue19930] os.makedirs('dir1/dir2', 0) always fails

2013-12-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Vajrasky. Now this check is skipped on Windows.

--
Added file: http://bugs.python.org/file33047/os_makedirs_mode_2.patch

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



[issue16669] Docstrings for namedtuple

2013-12-08 Thread Ned Batchelder

Ned Batchelder added the comment:

I'll add my voice to those asking for a way to put docstrings on namedtuples.  
As it is, namedtuples get automatic docstrings that seem to me to be almost 
worse than none.  Sphinx produces this:

```
class Key

Key(scope, user_id, block_scope_id, field_name)

__getnewargs__()

Return self as a plain tuple. Used by copy and pickle.

__repr__()

Return a nicely formatted representation string

block_scope_id None

Alias for field number 2

field_name None

Alias for field number 3

scope None

Alias for field number 0

user_id None

Alias for field number 1
```

Why are `__getnewargs__` and `__repr__` included at all, they aren't useful for 
API documentation.  The individual property docstrings offer no new information 
over the summary at the top.   I'd like namedtuple not to be so verbose where 
it has no useful information to offer.  The one-line summary is all the 
information namedtuple has, so that is all it should include in the docstring:

```
class Key

Key(scope, user_id, block_scope_id, field_name)
```

--
nosy: +nedbat

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



[issue16669] Docstrings for namedtuple

2013-12-08 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
status: closed - open

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



[issue16669] Docstrings for namedtuple

2013-12-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Unhide this discussion.

--

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



[issue19931] namedtuple docstrings are verbose for no added benefit

2013-12-08 Thread Ned Batchelder

New submission from Ned Batchelder:

When I make a namedtuple, I get automatic docstrings that use a lot of words to 
say very little.  Sphinx autodoc produces this:

```
class Key

Key(scope, user_id, block_scope_id, field_name)

__getnewargs__()

Return self as a plain tuple. Used by copy and pickle.

__repr__()

Return a nicely formatted representation string

block_scope_id None

Alias for field number 2

field_name None

Alias for field number 3

scope None

Alias for field number 0

user_id None

Alias for field number 1
```
The individual property docstrings offer no new information over the summary at 
the top.   I'd like namedtuple to be not so verbose where it has no useful 
information to offer.  The one-line summary is all the information namedtuple 
has, so that is all it should include in the docstring:

```
class Key

Key(scope, user_id, block_scope_id, field_name)
```

--
components: Library (Lib)
messages: 205584
nosy: nedbat
priority: normal
severity: normal
status: open
title: namedtuple docstrings are verbose for no added benefit
versions: Python 2.7, Python 3.3

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



[issue19931] namedtuple docstrings are verbose for no added benefit

2013-12-08 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +rhettinger

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



[issue19856] Possible bug in shutil.move() on Windows

2013-12-08 Thread Francisco Martín Brugué

Francisco Martín Brugué added the comment:

Just feedback on windows7. I tried the tests inside IDLE and done 'Run Module' 
(F5) (deleting the directories between tests):

test_A:

import os, shutil
os.makedirs('foo')
os.makedirs('bar/boo')
shutil.move('foo/', 'bar/')

test_B:

import os, shutil
os.makedirs('foo')
os.makedirs('bar/boo')
shutil.move('foo', 'bar/')

and finally test_C:

import os, shutil
os.makedirs('foo')
os.makedirs('bar/boo')
shutil.move('foo\\', 'bar/')


... and got the same traceback:

Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on 
win32
Type copyright, credits or license() for more information.
  RESTART 
 

Traceback (most recent call last):
  File D:\temp\test.py, line 4, in module
shutil.move('foo/','bar/')
  File D:\programs\Python27\lib\shutil.py, line 291, in move
raise Error, Destination path '%s' already exists % real_dst
Error: Destination path 'bar/' already exists


--
nosy: +francismb

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



[issue19923] OSError: [Errno 512] Unknown error 512 in test_multiprocessing

2013-12-08 Thread Charles-François Natali

Charles-François Natali added the comment:

Looks like a kernel bug.
errno 512 is ERESTARTSYS, which shouldn't leak to user-mode.

--

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



[issue16549] regression: -m json.tool module is broken

2013-12-08 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis added the comment:

Somehow these errors do not occur today. Maybe they were side effects of other 
failures in test_json. Closing for now.

--
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue19856] shutil.move() can't move a directory in non-empty directory on Windows

2013-12-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Francisco for testing. Here is different bug than I expected.

Looks as shutil.move() can't move a directory in non-empty directory on Windows.

--
nosy: +hynek, tarek
title: Possible bug in shutil.move() on Windows - shutil.move() can't move a 
directory in non-empty directory on Windows

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



[issue19913] TR/Crypt.XPACK.Gen-4 in easy_install.exe

2013-12-08 Thread Vinay Sajip

Vinay Sajip added the comment:

This commit in distlib uses uncompressed launcher executables which pass the 
virustotal.com checks:

https://bitbucket.org/pypa/distlib/commits/e23c9e4fd3125fa88063de4dec80367b1ac82aff

--

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



[issue19766] test_venv: test_with_pip() failed on AMD64 Fedora without threads 3.x buildbot: urllib3 dependency requires the threading module

2013-12-08 Thread Vinay Sajip

Vinay Sajip added the comment:

This commit in distlib uses uncompressed launcher executables which pass the 
virustotal.com checks:

https://bitbucket.org/pypa/distlib/commits/e23c9e4fd3125fa88063de4dec80367b1ac82aff

--

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



[issue18430] gzip, bz2, lzma: peek advances file position of existing file object

2013-12-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5ca6e8af0aab by Nadeem Vawda in branch '3.3':
#18430: Document that peek() may change the position of the underlying file for
http://hg.python.org/cpython/rev/5ca6e8af0aab

New changeset 0f587fe304be by Nadeem Vawda in branch 'default':
Closes #18430: Document that peek() may change the position of the underlying
http://hg.python.org/cpython/rev/0f587fe304be

--
nosy: +python-dev
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed

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



[issue19929] subprocess: increase read buffer size

2013-12-08 Thread Charles-François Natali

Charles-François Natali added the comment:

 Roundup Robot added the comment:

 New changeset 03a056c3b88e by Gregory P. Smith in branch '3.3':
 Fixes issue #19929: Call os.read with 32768 within subprocess.Popen
 http://hg.python.org/cpython/rev/03a056c3b88e

Not that it bothers me, but AFAICT this isn't a bugfix, and as such
shouldn't be backported to 3.3, no?

--

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



[issue19929] subprocess: increase read buffer size

2013-12-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 03a056c3b88e by Gregory P. Smith in branch '3.3':
Fixes issue #19929: Call os.read with 32768 within subprocess.Popen
http://hg.python.org/cpython/rev/03a056c3b88e

New changeset 4de4b5a4e405 by Gregory P. Smith in branch 'default':
Fixes issue #19929: Call os.read with 32768 within subprocess.Popen
http://hg.python.org/cpython/rev/4de4b5a4e405

--
nosy: +python-dev

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



[issue19929] subprocess: increase read buffer size

2013-12-08 Thread Gregory P. Smith

Gregory P. Smith added the comment:

I saw a small regression over 4k when using a 64k buffer on one of my machines 
(dual core amd64 linux).  With 32k everything (amd64 linux, armv7l 32-bit 
linux, 64-bit os x 10.6) showed a dramatic improvement on the microbenchmark.  
approaching 50% less cpu use in many cases.

i doubt applications will notice as much as they're likely to be dominated by 
their own application code rather than the subprocess internals.

re: 3.3 or not, true, but since it doesn't change any APIs and is minor I did 
it anyways.  If you think it doesn't belong there, leave it to the release 
manager to back out.  This and the #19506 change should be invisible to users.

--
resolution:  - fixed
stage: needs patch - commit review
status: open - closed

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



[issue5845] rlcompleter should be enabled automatically

2013-12-08 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I would say it's now closed. If there's some fine tuning needed, separate 
issues should be opened.

--
status: open - closed

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



[issue11299] Allow deepcopying paused generators

2013-12-08 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Instead of copy.deepcopy, why not call itertools.tee?

For the record, pickling a live generator implies pickling a frame object. We 
wouldn't be able to guarantee cross-version compatibility for such pickled 
objects.

--

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



[issue19883] Integer overflow in zipimport.c

2013-12-08 Thread Gregory P. Smith

Gregory P. Smith added the comment:

comments added to the patch.

--

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



[issue11299] Allow deepcopying paused generators

2013-12-08 Thread Alexandre Vassalotti

Alexandre Vassalotti added the comment:

The issue here is copy.deepcopy will raise an exception whenever it encounters 
a generator. We would like to do better here. Unfortunately, using 
itertools.tee is not a solution here because it does not preserve the type of 
the object.

--

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



[issue11299] Allow deepcopying paused generators

2013-12-08 Thread Ram Rachum

Ram Rachum added the comment:

Instead of copy.deepcopy, why not call itertools.tee?

It's hard for me to give you a good answer because I submitted this ticket 2 
years ago, and nowadays I don't have personal interest in it anymore.

But, I think `itertools.tee` wouldn't have worked for me, because it just saves 
the value rather than really duplicating the generator.

--

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



[issue11299] Allow deepcopying paused generators

2013-12-08 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 The issue here is copy.deepcopy will raise an exception whenever it
 encounters a generator. We would like to do better here.
 Unfortunately, using itertools.tee is not a solution here because it
 does not preserve the type of the object.

Indeed, itertools.tee is not a general solution for copy.deepcopy, but
it's a good solution to *avoid* calling copy.deepcopy when you simply
want to fork a generator.

IMHO supporting live generators (and therefore frame objects) in
copy.deepcopy would be a waste of effort.

--

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



[issue19542] WeakValueDictionary bug in setdefault()pop()

2013-12-08 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
nosy: +fdrake, pitrou

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



[issue11299] Allow deepcopying paused generators

2013-12-08 Thread Bastien Montagne

Bastien Montagne added the comment:

Yes, itertools.tee just keep in memory elements produced by the most advanced 
iterator, until the least advanced iterator consumes them. It may not be a 
big issue in most cases, but I can assure you that when you have to iter 
several times over a million of vertices, this is not a good solution… ;)

Fortunately, in this case I can just produce several times the same generator, 
but still, would be nicer (at least on the “beauty of the code” aspect) if 
there was a way to really duplicate generators.

Unless I misunderstood things, and deepcopying a generator would imply to also 
copy its whole source of data?

--

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



[issue11299] Allow deepcopying paused generators

2013-12-08 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Unless I misunderstood things, and deepcopying a generator would imply
 to also copy its whole source of data?

deepcopying is deep, and so would have to recursively deepcopy the
generator's local variables...

--

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



[issue19542] WeakValueDictionary bug in setdefault()pop()

2013-12-08 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I think the underlying question is: are weak dicts otherwise MT-safe?

--
versions: +Python 3.4

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



[issue19915] int.bit_at(n) - Accessing a single bit in O(1)

2013-12-08 Thread anon

anon added the comment:

Then I think we're in agreement with regards to bits_at. :) What should happen 
next?

--

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



[issue19932] Missing spaces in import.h?

2013-12-08 Thread Ziyuan Lin

New submission from Ziyuan Lin:

In Include\import.h, line 89-97:

PyAPI_FUNC(PyObject *)_PyImport_FindBuiltin(
const char *name/* UTF-8 encoded string */
);
PyAPI_FUNC(PyObject *)_PyImport_FindExtensionObject(PyObject *, PyObject *);
PyAPI_FUNC(int)_PyImport_FixupBuiltin(
PyObject *mod,
char *name  /* UTF-8 encoded string */
);
PyAPI_FUNC(int)_PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject 
*);


Shouldn't they be the following:

PyAPI_FUNC(PyObject *) _PyImport_FindBuiltin(
const char *name/* UTF-8 encoded string */
);
PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObject(PyObject *, PyObject *);
PyAPI_FUNC(int)_PyImport_FixupBuiltin(
PyObject *mod,
char *name  /* UTF-8 encoded string */
);
PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject 
*);

--
messages: 205605
nosy: Ziyuan.Lin
priority: normal
severity: normal
status: open
title: Missing spaces in import.h?
type: compile error
versions: Python 3.3

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



[issue19876] selectors (and asyncio?): document behaviour on closed files/sockets

2013-12-08 Thread Guido van Rossum

Guido van Rossum added the comment:

I don't think we should be more selective about the errno values, the try block 
is narrow enough (just one syscall) and we really don't know what the kernel 
will do on different platforms.  And what would we do about it anyway?

I will look into the Windows problem, but I suspect the best we can do there is 
skip the test.

--

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



[issue19876] selectors (and asyncio?): document behaviour on closed files/sockets

2013-12-08 Thread Charles-François Natali

Charles-François Natali added the comment:

 I will look into the Windows problem, but I suspect the best we can do there 
 is skip the test.

I already took care of that:
http://hg.python.org/cpython/rev/01676a4c16ff

--

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



[issue19876] selectors (and asyncio?): document behaviour on closed files/sockets

2013-12-08 Thread Guido van Rossum

Guido van Rossum added the comment:

Then here's a hopeful fix for the Windows situation that relies on the 
socketpair() operation reusing FDs from the lowest value. I'm adding asserts to 
check that this is actually the case. (These are actual assert statements to 
indicate that they are verifying an assumption internal to the test, not 
verifying the functionality under test.)

I'll test it when I next get near a Windows box (Monday in the office) -- or 
someone else with Windows access can let me know.

--
Added file: http://bugs.python.org/file33048/nodup2.diff

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



[issue19542] WeakValueDictionary bug in setdefault()pop()

2013-12-08 Thread Armin Rigo

Armin Rigo added the comment:

As you can see in x.py, the underlying question is rather: are weakdicts usable 
in a single thread of a multithreaded program?  I believe that this question 
cannot reasonably be answered No, independently on the answer you want to give 
to your own question.

--

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



[issue19932] Missing spaces in import.h?

2013-12-08 Thread Ziyuan Lin

Ziyuan Lin added the comment:

To see the errors, one can install PyCUDA and Theano, and run code at 
http://deeplearning.net/software/theano/tutorial/using_gpu.html#id1 :


import numpy, theano
import theano.misc.pycuda_init
from pycuda.compiler import SourceModule
import theano.sandbox.cuda as cuda

class PyCUDADoubleOp(theano.Op):
def __eq__(self, other):
return type(self) == type(other)
def __hash__(self):
return hash(type(self))
def __str__(self):
return self.__class__.__name__
def make_node(self, inp):
inp = cuda.basic_ops.gpu_contiguous(
   cuda.basic_ops.as_cuda_ndarray_variable(inp))
assert inp.dtype == float32
return theano.Apply(self, [inp], [inp.type()])
def make_thunk(self, node, storage_map, _, _2):
mod = SourceModule(
__global__ void my_fct(float * i0, float * o0, int size) {
int i = blockIdx.x*blockDim.x + threadIdx.x;
if(isize){
o0[i] = i0[i]*2;
}
  })
pycuda_fct = mod.get_function(my_fct)
inputs = [ storage_map[v] for v in node.inputs]
outputs = [ storage_map[v] for v in node.outputs]
def thunk():
z = outputs[0]
if z[0] is None or z[0].shape!=inputs[0][0].shape:
z[0] = cuda.CudaNdarray.zeros(inputs[0][0].shape)
grid = (int(numpy.ceil(inputs[0][0].size / 512.)),1)
pycuda_fct(inputs[0][0], z[0], numpy.intc(inputs[0][0].size),
   block=(512,1,1), grid=grid)
return thunk


The interpreter will complain errors like c:\python33\include\import.h(97): 
error: explicit type is missing (int assumed) (at least in my case)

--

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



[issue19846] print() and write() are relying on sys.getfilesystemencoding() instead of sys.getdefaultencoding()

2013-12-08 Thread STINNER Victor

STINNER Victor added the comment:

haypo: title: Setting LANG=C breaks Python 3 - print() and write() are 
relying on sys.getfilesystemencoding() instead of sys.getdefaultencoding()

Oh, I didn't want to change the title of the issue, it's a bug in Roundup when 
I reply by email :-/

--

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



[issue19846] Setting LANG=C breaks Python 3

2013-12-08 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
title: print() and write() are relying on sys.getfilesystemencoding() instead 
of sys.getdefaultencoding() - Setting LANG=C breaks Python 3

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



[issue18983] Specify time unit for timeit CLI

2013-12-08 Thread Julian Gindi

Julian Gindi added the comment:

Just wanted to check to see if there was anything else I should do regarding 
this issue.

--

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



[issue18983] Specify time unit for timeit CLI

2013-12-08 Thread Ezio Melotti

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


--
nosy: +ezio.melotti
stage: needs patch - patch review
versions: +Python 3.5 -Python 3.4

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



[issue19915] int.bit_at(n) - Accessing a single bit in O(1)

2013-12-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Extracting sign, exponent and significand fields from the binary
 representation of a float is at least one thing I'd use this for.

You don't need special function for bit operations. Float values are short (32 
or 64 bits) and any bit operations are O(1). Special function for bit 
extracting (or modifying) is needed when you process many hundreds or 
thousands of bits. In any case  and  for 64-bit values are faster than 
method call.

--

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



[issue19542] WeakValueDictionary bug in setdefault()pop()

2013-12-08 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ah, you're right. We just need to cook up a patch then.

--
stage:  - needs patch
type:  - behavior

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



[issue19846] Setting LANG=C breaks Python 3

2013-12-08 Thread STINNER Victor

STINNER Victor added the comment:

 Or said differently, the filesystem encoding is different than the
 locale encoding.

 Indeed, but the FS encoding and the IO encoding are the same.
 locale encoding doesn't really matter here, as we are assuming that
 it's wrong.

Oh, I realized that FS encoding term in not clear. When I wrote FS 
encoding, I mean sys.getfilesystemencoding() which is mbcs on Windows, UTF-8 
on Mac OS X and (currently) the locale encoding on other platforms (UNIX, ex: 
Linux/FreeBSD/Solaris/AIX).

--

IMO there are two different points in this issue:

(a) which encoding should be used when the C locale is used: the encoding 
announced by the OS using nl_langinfo(CODESET) (current choice) or use an 
arbitrary optimistic utf-8 encoding?

(b) for technical reasons, Python reuses the C codec during Python 
initialization to decode and encode OS data, and so currently Python *must* use 
the locale encoding for its filesystem encoding

Before being able to pronounce me on the point (a), I would like to see a patch 
fixing the point (b). I'm not against fixing point (b). I'm just saying that 
it's not trivial and obviously it must be fixed to change the status of point 
(a). I even gave clues to fix point (b).

--

asciilocale.patch has many issues. Try to run the Python test suite using this 
patch to see what I mean. Example of failures:

==
FAIL: test_non_ascii (test.test_cmd_line.CmdLineTest)
--
Traceback (most recent call last):
  File /home/haypo/prog/python/default/Lib/test/test_cmd_line.py, line 140, 
in test_non_ascii
assert_python_ok('-c', command)
  File /home/haypo/prog/python/default/Lib/test/script_helper.py, line 69, in 
assert_python_ok
return _assert_python(True, *args, **env_vars)
  File /home/haypo/prog/python/default/Lib/test/script_helper.py, line 55, in 
_assert_python
stderr follows:\n%s % (rc, err.decode('ascii', 'ignore')))
AssertionError: Process return code is 1, stderr follows:
Unable to decode the command from the command line:
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcc3' in position 
12: surrogates not allowed

==
FAIL: test_ioencoding_nonascii (test.test_sys.SysModuleTest)
--
Traceback (most recent call last):
  File /home/haypo/prog/python/default/Lib/test/test_sys.py, line 603, in 
test_ioencoding_nonascii
self.assertEqual(out, os.fsencode(test.support.FS_NONASCII))
AssertionError: b'' != b'\xc3\xa6'

==
FAIL: test_nonascii (test.test_warnings.CEnvironmentVariableTests)
--
Traceback (most recent call last):
  File /home/haypo/prog/python/default/Lib/test/test_warnings.py, line 774, 
in test_nonascii
['ignore:Deprecaci\xf3nWarning'].encode('utf-8'))
AssertionError: b['ignore:Deprecaci\\udcc3\\udcb3nWarning'] != 
b['ignore:Deprecaci\xc3\xb3nWarning']

==
FAIL: test_nonascii (test.test_warnings.PyEnvironmentVariableTests)
--
Traceback (most recent call last):
  File /home/haypo/prog/python/default/Lib/test/test_warnings.py, line 774, 
in test_nonascii
['ignore:Deprecaci\xf3nWarning'].encode('utf-8'))
AssertionError: b['ignore:Deprecaci\\udcc3\\udcb3nWarning'] != 
b['ignore:Deprecaci\xc3\xb3nWarning']


test_warnings is probably #9988, test_cmd_line failure is maybe #9992.

There are maybe other issues, the Python test suite only have a few tests for 
non-ASCII characters.

--

If anything is changed, I would prefer to have more than a few months of test 
to make sure that it doesn't break anything. So I set the version field to 
Python 3.5.

--
versions: +Python 3.5 -Python 3.4

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



  1   2   >