[issue23782] Leak in _PyTraceback_Add

2015-03-26 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

There is a leak of fetched exception in _PyTraceback_Add() 
(Python/traceback.c:146).

--
messages: 239319
nosy: georg.brandl, haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Leak in _PyTraceback_Add
type: resource usage

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



[issue23780] Surprising behaviour when passing list to os.path.join.

2015-03-26 Thread Pikec

Boštjan Mejak (Pikec) added the comment:

Using Python 3.4.3 on Windows 7 Home Premium 64 bit, Service Pack 1:

 import os
 os.path.join([1, 2, 3])
Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\Program Files\Python 3.4\lib\ntpath.py, line 108, in join
result_drive, result_path = splitdrive(path)
  File C:\Program Files\Python 3.4\lib\ntpath.py, line 161, in splitdrive
normp = p.replace(_get_altsep(p), sep)
AttributeError: 'list' object has no attribute 'replace'

I think this atribute error should be handled differently, like informing the 
programmer that you cannot use a list in the join method.

--
nosy: +Boštjan Mejak (Pikec)

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



[issue18408] Fixes crashes found by pyfailmalloc

2015-03-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b742c1c5c0bf by Victor Stinner in branch 'default':
PEP 490: add issue 18408
https://hg.python.org/peps/rev/b742c1c5c0bf

--

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



[issue23781] Add private _PyErr_ReplaceException() in 2.7

2015-03-26 Thread STINNER Victor

STINNER Victor added the comment:

FIY I'm working on a draft of new PEP to chain exceptions at C level: PEP 490.

--

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



[issue23781] Add private _PyErr_ReplaceException() in 2.7

2015-03-26 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch adds internal private function _PyErr_ReplaceException() in 2.7. 
This functions is like _PyErr_ChainExceptions() in 3.x, but doesn't set the 
context. It makes the code of 2.x simpler and more similar to 3.x and makes the 
backporting from 3.x easier.

--
components: Interpreter Core
files: capi_PyErr_ReplaceException.patch
keywords: patch
messages: 239317
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Add private _PyErr_ReplaceException() in 2.7
type: enhancement
versions: Python 2.7
Added file: http://bugs.python.org/file38697/capi_PyErr_ReplaceException.patch

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



[issue23780] Surprising behaviour when passing list to os.path.join.

2015-03-26 Thread Boštjan Mejak

Changes by Boštjan Mejak bostjan.xpe...@gmail.com:


--
versions: +Python 3.5

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



[issue23782] Leak in _PyTraceback_Add

2015-03-26 Thread STINNER Victor

STINNER Victor added the comment:

If a new exception is raised by _PyTraceback_Add(), the original exception is 
lost. It's sad because _PyTraceback_Add() is supposed to enhance the current 
exception, not to drop it.

In the draft of my PEP 490, I propose to chain the two exceptions.

--

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



[issue18828] urljoin behaves differently with custom and standard schemas

2015-03-26 Thread Martin Panter

Martin Panter added the comment:

The current behaviour when no scheme is present is fairly sensible to me and 
should not be changed to do string concatenation nor raise an exception:

 urljoin(//netloc/old/path, new/path)
'//netloc/old/new/path'

I am posting urljoin-non-hier.patch as an alternative to my first patch. This 
one changes urljoin() to work on any URL scheme not in the existing 
“non_hierarchical” blacklist. I removed the gopher, wais, and imap schemes from 
the list, and added tel, so that urljoin() continues to treat these special 
cases as before. Out of the schemes mentioned in the module but missing from 
uses_relative, I think non_hierarchical now has all those without directory 
components: hdl, mailto, news, sip, sips, snews, tel, telnet.

However I am still not really convinced that my first urljoin-scheme.patch is a 
bad idea. Do people actually use urljoin() with these schemes like mailto in 
the first place?

--
Added file: http://bugs.python.org/file38698/urljoin-non-hier.patch

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



[issue23784] Reloading tokenize module leads to error

2015-03-26 Thread David Marks

New submission from David Marks:

On 432 in tokenize.py there is an assignment

_builtin_open = open

Followed in 434 with a redefinition of open

def open(filename):

If the module is reloaded, _builtin_open gets reassigned to the new function 
and subsequent calls to _builtin_open fail.

--
components: Library (Lib)
messages: 239322
nosy: dmarks
priority: normal
severity: normal
status: open
title: Reloading tokenize module leads to error
type: behavior
versions: Python 3.4

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



[issue23783] Leak in PyObject_ClearWeakRefs

2015-03-26 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

If restore_error == 1 in PyObject_ClearWeakRefs() (Objects/weakrefobject.c:883) 
and PyTuple_New() fails in Objects/weakrefobject.c:923, PyErr_Fetch is called 
twice and both exceptions leak.

--
components: Extension Modules
messages: 239320
nosy: fdrake, haypo, pitrou, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Leak in PyObject_ClearWeakRefs
type: resource usage

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



[issue23784] Reloading tokenize module leads to error

2015-03-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Fixed in issue23615.

--
nosy: +serhiy.storchaka
resolution:  - out of date
stage:  - resolved
status: open - closed

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



[issue23663] Crash on failure in ctypes on Cygwin

2015-03-26 Thread Masayuki Yamamoto

Masayuki Yamamoto added the comment:

similar issue #23338: PyErr_Format in ctypes uses invalid parameter

--
nosy: +masamoto

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



[issue23783] Leak in PyObject_ClearWeakRefs

2015-03-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Proposed patch should fix the issue.

--
keywords: +patch
stage:  - patch review
versions: +Python 2.7, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file38700/issue23783.patch

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



[issue23784] Reloading tokenize module leads to error

2015-03-26 Thread STINNER Victor

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


--
resolution: out of date - fixed

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



[issue23785] Leak in TextIOWrapper.tell()

2015-03-26 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

If an exception was raised in TextIOWrapper.tell() and then restoring state is 
failed, original exception is lost and leaked.

--
components: Extension Modules
messages: 239327
nosy: benjamin.peterson, haypo, pitrou, serhiy.storchaka, stutzbach
priority: normal
severity: normal
status: open
title: Leak in TextIOWrapper.tell()
type: resource usage
versions: Python 2.7, Python 3.4, Python 3.5

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



[issue23663] Crash on failure in ctypes on Cygwin

2015-03-26 Thread David Macek

David Macek added the comment:

Yeah, looks like exactly the same issue. Sorry for the duplicate.

--

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



[issue23785] Leak in TextIOWrapper.tell()

2015-03-26 Thread Serhiy Storchaka

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


--
keywords: +patch
Added file: http://bugs.python.org/file38699/issue23785.patch

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



[issue23785] Leak in TextIOWrapper.tell()

2015-03-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Proposed patch chain original exception to the exception raised by 
setstate(saved_state). This matches the behavior of Python implementation.

--
stage:  - patch review

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



[issue23605] Use the new os.scandir() function in os.walk()

2015-03-26 Thread Ben Hoyt

Ben Hoyt added the comment:

Victor, great work on pushing this out, especially with the modifying the 
directories fix. (And thanks Serhiy for pushing on correctness here.)

Couple of comments/questions about your new os.walk() implementation.

1) The new implementation is more complex. Of course, most of this is necessary 
due to the topdown directory issue. However, one thing I'm not sure about is 
why you create scandir_it manually and use a while True loop, adding complexity 
and making it require two versions of the error handling. Why not a simple for 
entry in scandir(top): ... with a try/except OSError around the whole loop? I 
could well be missing something here though.

2) In this commit http://bugs.python.org/review/23605/diff/14181/Lib/os.py -- 
which is not the final one, I don't quite understand the catch_oserror thing. 
Presumably this turned out to be unnecessary, as it's not in the final version?

3) Really minor thing: in one of the comments, you misspell symbolik. Should 
be symbolic.

--

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



[issue4944] os.fsync() doesn't work as expect in Windows

2015-03-26 Thread eryksun

eryksun added the comment:

Emil,

Your example child process opens the file with only read sharing, which fails 
with a sharing violation if some other process inherits the file handle with 
write access. The `with` block only prevents this in a single-threaded 
environment. When you spawn 10 children, each from a separate thread, there's a 
good chance that one child will inherit a handle that triggers a sharing 
violation in another child.

Using close_fds is a blunt solution since it prevents inheriting all 
inheritable handles. What you really need here has actually already been done 
for you. Just use the file descriptor that mkstemp returns, i.e. use 
os.fdopen(infd, 'wb'). mkstemp opens the file with O_NOINHERIT set in the flags.

--
nosy: +eryksun

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



[issue21085] compile error Python3.3 on Cygwin

2015-03-26 Thread STINNER Victor

STINNER Victor added the comment:

Could you please use a define like SIGINFO_HAS_SI_BAND?

Something like:

#if defined(HAVE_SIGINFO)  !defined(__CYGWIN__)
   /* Issue #21085: In Cygwin, siginfo_t does not have si_band field. */
#  define SIGINFO_HAS_SI_BAND
#endif

And please generate patches not the git format. Otherwise, Rietveld is unable 
to generated the review link.

--

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



[issue23771] Timeouts on x86 Ubuntu Shared 3.x buildbot

2015-03-26 Thread STINNER Victor

STINNER Victor added the comment:

A new failure test_subprocess.test_double_close_on_error:

http://buildbot.python.org/all/builders/x86%20Ubuntu%20Shared%203.x/builds/11411/steps/test/logs/stdio
---
Timeout (1:00:00)!
Thread 0x55aafdc0 (most recent call first):
  File /srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/subprocess.py, line 
1407 in _execute_child
  File /srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/subprocess.py, line 
855 in __init__
  File 
/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_subprocess.py, 
line 1074 in test_double_close_on_error
  File /srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/unittest/case.py, 
line 577 in run
  File /srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/unittest/case.py, 
line 625 in __call__
  File /srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/unittest/suite.py, 
line 122 in run
  File /srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/unittest/suite.py, 
line 84 in __call__
  File /srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/unittest/suite.py, 
line 122 in run
  File /srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/unittest/suite.py, 
line 84 in __call__
  File /srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/unittest/runner.py, 
line 176 in run
  File 
/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/support/__init__.py, 
line 1773 in _run_suite
  File 
/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/support/__init__.py, 
line 1807 in run_unittest
  File 
/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_subprocess.py, 
line 2532 in test_main
  File /srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/regrtest.py, 
line 1284 in runtest_inner
  File /srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/regrtest.py, 
line 967 in runtest
  File /srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/regrtest.py, 
line 763 in main
  File /srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/regrtest.py, 
line 1568 in main_in_temp_cwd
  File /srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/__main__.py, 
line 3 in module
  File /srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/runpy.py, line 85 
in _run_code
  File /srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/runpy.py, line 170 
in _run_module_as_main
make: *** [buildbottest] Error 1
---

--

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



[issue23786] test_unaligned_buffers (test.test_hash.HashEqualityTestCase) ... Fatal Python error: Bus error

2015-03-26 Thread Peter

Peter added the comment:

I went and recompiled with:
$ ./configure --prefix=/usr/local --enable-shared 
--with-hash-algorithm=siphash24

But this crashed as well.

test_unaligned_buffers (test.test_hash.HashEqualityTestCase) ... Fatal Python 
error: Bus error

Current thread 0x0001 (most recent call first):
  File /usr/local/src/Python-3.4.3/Lib/test/test_hash.py, line 89 in 
test_unaligned_buffers
  File /usr/local/src/Python-3.4.3/Lib/unittest/case.py, line 577 in run
  File /usr/local/src/Python-3.4.3/Lib/unittest/case.py, line 625 in __call__
  File /usr/local/src/Python-3.4.3/Lib/unittest/suite.py, line 122 in run
  File /usr/local/src/Python-3.4.3/Lib/unittest/suite.py, line 84 in __call__
  File /usr/local/src/Python-3.4.3/Lib/unittest/suite.py, line 122 in run
  File /usr/local/src/Python-3.4.3/Lib/unittest/suite.py, line 84 in __call__
  File /usr/local/src/Python-3.4.3/Lib/unittest/suite.py, line 122 in run
  File /usr/local/src/Python-3.4.3/Lib/unittest/suite.py, line 84 in __call__
  File /usr/local/src/Python-3.4.3/Lib/unittest/runner.py, line 168 in run
  File /usr/local/src/Python-3.4.3/Lib/test/support/__init__.py, line 1769 in 
_run_suite
  File /usr/local/src/Python-3.4.3/Lib/test/support/__init__.py, line 1803 in 
run_unittest
  File /usr/local/src/Python-3.4.3/Lib/test/regrtest.py, line 1279 in 
test_runner
  File /usr/local/src/Python-3.4.3/Lib/test/regrtest.py, line 1280 in 
runtest_inner
  File /usr/local/src/Python-3.4.3/Lib/test/regrtest.py, line 978 in runtest
  File /usr/local/src/Python-3.4.3/Lib/test/regrtest.py, line 763 in main
  File /usr/local/src/Python-3.4.3/Lib/test/regrtest.py, line 1564 in 
main_in_temp_cwd
  File /usr/local/src/Python-3.4.3/Lib/test/__main__.py, line 3 in module
  File /usr/local/src/Python-3.4.3/Lib/runpy.py, line 85 in _run_code
  File /usr/local/src/Python-3.4.3/Lib/runpy.py, line 170 in 
_run_module_as_main
Bus Error (core dumped)


test_unaligned_buffers (test.test_hash.HashEqualityTestCase) ...
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1 (LWP 1)]
0xff25d3d8 in siphash24 (src=0x1d2809, src_sz=optimized out) at 
Python/pyhash.c:387
387 PY_UINT64_T mi = _le64toh(*in);
(gdb) bt
#0  0xff25d3d8 in siphash24 (src=0x1d2809, src_sz=optimized out) at 
Python/pyhash.c:387
#1  0xff25dfa0 in _Py_HashBytes (src=0x1d2809, len=127) at Python/pyhash.c:186
#2  0xff1a7ce4 in memory_hash (self=0xfdfc5dc0) at Objects/memoryobject.c:2793
#3  0xff1afa40 in PyObject_Hash (v=0xfdfc5dc0) at Objects/object.c:757
#4  0xff22b6fc in builtin_hash (self=0xfee23600, v=0xfdfc5dc0) at 
Python/bltinmodule.c:1269
#5  0xff236a70 in call_function (oparg=optimized out, pp_stack=0xffbfcd64) at 
Python/ceval.c:4224
#6  PyEval_EvalFrameEx (f=optimized out, throwflag=optimized out) at 
Python/ceval.c:2838
#7  0xff237790 in fast_function (nk=optimized out, na=optimized out, n=1, 
pp_stack=0xffbfce5c,
func=optimized out) at Python/ceval.c:4334


(gdb) list
382 PY_UINT64_T t;
383 PY_UINT8_T *pt;
384 PY_UINT8_T *m;
385
386 while (src_sz = 8) {
387 PY_UINT64_T mi = _le64toh(*in);
388 in += 1;
389 src_sz -= 8;
390 v3 ^= mi;
391 DOUBLE_ROUND(v0,v1,v2,v3);

--

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



[issue21085] compile error Python3.3 on Cygwin

2015-03-26 Thread STINNER Victor

STINNER Victor added the comment:

 In that case, May I edit configure script to generate the HAVE_* defines?
 I'd like to add a statement to check the si_band to configure.ac.

Does Cygwin use configure? If yes, go for configure.

You can copy/paste my recent change for dirent.d_type field.

 I see.  I use the mercurial repository from next time.

Are you using git or hg? If you use hg, just change the config to not use
git format. If you use git, don't worry, I can review without the review
button.

--

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



[issue21085] compile error Python3.3 on Cygwin

2015-03-26 Thread Masayuki Yamamoto

Masayuki Yamamoto added the comment:

Victor,

In that case, May I edit configure script to generate the HAVE_* defines?
I'd like to add a statement to check the si_band to configure.ac.

 And please generate patches not the git format. Otherwise, Rietveld is unable 
 to generated the review link.
I see.  I use the mercurial repository from next time.

--

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



[issue23786] test_unaligned_buffers (test.test_hash.HashEqualityTestCase) ... Fatal Python error: Bus error

2015-03-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Siphash24 implementation is not designed to work on platforms that require 
aligned access. But I'm surprised that fnv implementation crashes. I don't see 
anything wrong. May be gcc needs some special options to produce correct 
binaries on this platform?

--
nosy: +serhiy.storchaka

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



[issue23290] Faster set copying

2015-03-26 Thread STINNER Victor

STINNER Victor added the comment:

Is msg234811 the result of set_faster_copy_3.patch? If yes, I see no reason to 
not apply the patch: the patch is short and looks always fast, and sometimes 
*much* faster.

I just leaved a small comment on the review.

--
nosy: +haypo

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



[issue23611] Pickle nested names with protocols 4

2015-03-26 Thread STINNER Victor

STINNER Victor added the comment:

 It is used in multiprocessing and this is not configurable.

Oh, it would be nice to switch to version 4 by default, or make it
configurable. I read that the version 4 is faster.

--

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



[issue23529] Limit decompressed data when reading from LZMAFile and BZ2File

2015-03-26 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Is it still work-in-progress or are you looking for a review?

--

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



[issue23529] Limit decompressed data when reading from LZMAFile and BZ2File

2015-03-26 Thread Nikolaus Rath

Nikolaus Rath added the comment:

I believe Martin's patch (v8) is ready for a core committer review. At least I 
can't find anything to criticize anymore :-).

--

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



[issue23786] test_unaligned_buffers (test.test_hash.HashEqualityTestCase) ... Fatal Python error: Bus error

2015-03-26 Thread Peter

New submission from Peter:

I compiled Python 3.4.3 on Solaris 11, and when I ran the regression test, I 
get a core dump when the hash() function was being used. I went through the bug 
database looking for something similar but couldn't find anything.

Tests like:
test_unaligned_buffers (test.test_hash.HashEqualityTestCase) ... Fatal Python 
error: Bus error

Current thread 0x0001 (most recent call first):
  File /usr/local/lib/python3.4/test/test_hash.py, line 89 in 
test_unaligned_buffers
  File /usr/local/lib/python3.4/unittest/case.py, line 577 in run
  File /usr/local/lib/python3.4/unittest/case.py, line 625 in __call__
  File /usr/local/lib/python3.4/unittest/suite.py, line 122 in run
  File /usr/local/lib/python3.4/unittest/suite.py, line 84 in __call__
  File /usr/local/lib/python3.4/unittest/suite.py, line 122 in run
  File /usr/local/lib/python3.4/unittest/suite.py, line 84 in __call__
  File /usr/local/lib/python3.4/unittest/suite.py, line 122 in run
  File /usr/local/lib/python3.4/unittest/suite.py, line 84 in __call__
  File /usr/local/lib/python3.4/unittest/runner.py, line 168 in run
  File /usr/local/lib/python3.4/test/support/__init__.py, line 1769 in 
_run_suite
  File /usr/local/lib/python3.4/test/support/__init__.py, line 1803 in 
run_unittest
  File /usr/local/lib/python3.4/test/regrtest.py, line 1279 in test_runner
  File /usr/local/lib/python3.4/test/regrtest.py, line 1280 in runtest_inner
  File /usr/local/lib/python3.4/test/regrtest.py, line 978 in runtest
  File /usr/local/lib/python3.4/test/regrtest.py, line 763 in main
  File /usr/local/lib/python3.4/test/regrtest.py, line 1564 in 
main_in_temp_cwd
  File /usr/local/lib/python3.4/test/__main__.py, line 3 in module
  File /usr/local/lib/python3.4/runpy.py, line 85 in _run_code
  File /usr/local/lib/python3.4/runpy.py, line 170 in _run_module_as_main
Bus Error (core dumped)


and


test_hash_equality (test.datetimetester.TestTime_Fast) ... Fatal Python error: 
Bus error

Current thread 0x0001 (most recent call first):
  File /usr/local/lib/python3.4/test/datetimetester.py, line 2155 in 
test_hash_equality
  File /usr/local/lib/python3.4/unittest/case.py, line 577 in run
  File /usr/local/lib/python3.4/unittest/case.py, line 625 in __call__
  File /usr/local/lib/python3.4/unittest/suite.py, line 122 in run
  File /usr/local/lib/python3.4/unittest/suite.py, line 84 in __call__
  File /usr/local/lib/python3.4/unittest/suite.py, line 122 in run
  File /usr/local/lib/python3.4/unittest/suite.py, line 84 in __call__
  File /usr/local/lib/python3.4/unittest/runner.py, line 168 in run
  File /usr/local/lib/python3.4/test/support/__init__.py, line 1769 in 
_run_suite
  File /usr/local/lib/python3.4/test/support/__init__.py, line 1803 in 
run_unittest
  File /usr/local/lib/python3.4/test/test_datetime.py, line 45 in test_main
  File /usr/local/lib/python3.4/test/regrtest.py, line 1280 in runtest_inner
  File /usr/local/lib/python3.4/test/regrtest.py, line 978 in runtest
  File /usr/local/lib/python3.4/test/regrtest.py, line 763 in main
  File /usr/local/lib/python3.4/test/regrtest.py, line 1564 in 
main_in_temp_cwd
  File /usr/local/lib/python3.4/test/__main__.py, line 3 in module
  File /usr/local/lib/python3.4/runpy.py, line 85 in _run_code
  File /usr/local/lib/python3.4/runpy.py, line 170 in _run_module_as_main
Bus Error (core dumped)



I then ran the same test through gdb:
$ gdb /usr/local/bin/python3.4
GNU gdb (GDB) 7.8.1
snip
(gdb) run -m test -v test_hash
Starting program: /usr/local/bin/python3.4 -m test -v test_hash
[Thread debugging using libthread_db enabled]
[New Thread 1 (LWP 1)]
== CPython 3.4.3 (default, Mar 25 2015, 17:35:25) [GCC 4.6.2]
==   Solaris-2.11-sun4v-sparc-32bit-ELF big-endian
==   hash algorithm: fnv 32bit
==   /tmp/test_python_12329
Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, 
dont_write_bytecode=0, no_user_site=0, no_
site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, 
hash_randomization=1, isolated=0)
[1/1] test_hash
test_empty_string (test.test_hash.BytesHashRandomizationTests) ... ok
test_fixed_hash (test.test_hash.BytesHashRandomizationTests) ... ok
test_long_fixed_hash (test.test_hash.BytesHashRandomizationTests) ... ok
test_null_hash (test.test_hash.BytesHashRandomizationTests) ... ok
test_randomized_hash (test.test_hash.BytesHashRandomizationTests) ... ok
test_randomized_hash (test.test_hash.DatetimeDateTests) ... ok
test_randomized_hash (test.test_hash.DatetimeDatetimeTests) ... FAIL
test_randomized_hash (test.test_hash.DatetimeTimeTests) ... FAIL
test_hashes (test.test_hash.HashBuiltinsTestCase) ... ok
test_hash_distribution (test.test_hash.HashDistributionTestCase) ... ok
test_coerced_floats (test.test_hash.HashEqualityTestCase) ... ok
test_coerced_integers (test.test_hash.HashEqualityTestCase) ... ok
test_numeric_literals (test.test_hash.HashEqualityTestCase) ... ok
test_unaligned_buffers (test.test_hash.HashEqualityTestCase) ...
Program 

[issue23786] test_unaligned_buffers (test.test_hash.HashEqualityTestCase) ... Fatal Python error: Bus error

2015-03-26 Thread Serhiy Storchaka

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


--
nosy: +christian.heimes, jcea
versions: +Python 3.5

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



[issue23785] Leak in TextIOWrapper.tell()

2015-03-26 Thread Benjamin Peterson

Benjamin Peterson added the comment:

lgtm with a test

--

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



[issue23785] Leak in TextIOWrapper.tell()

2015-03-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It would be not easy to reproduce without special broken decoder.

--

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



[issue23785] Leak in TextIOWrapper.tell()

2015-03-26 Thread Benjamin Peterson

Benjamin Peterson added the comment:

How did you notice it, btw?

--

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



[issue23676] Add support of UnicodeTranslateError in standard error handlers

2015-03-26 Thread STINNER Victor

STINNER Victor added the comment:

I'm sorry, I don't understand this issue. Could you please elaborate the use 
case? Why do you want to support more error handlers? str.translate() calls 
_PyUnicode_TranslateCharmap() with errors=ignore, it's not possible to choose 
the error handler.

Many codecs are implemented in Python and some of them are implemented with 
charmap. Does this issue enhance the codecs implemented with charmap?

a\udc80.encode(latin9, surrogatepass) raises UnicodeEncodeError with and 
without the patch, b\x81.decode(cp1252, surrogatepass) raises 
UnicodeDecodeError with and without the patch.

Hum, I'm not sure that codecs.charmap_build() is related str.translate().

--
nosy: +haypo

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



[issue23786] test_unaligned_buffers (test.test_hash.HashEqualityTestCase) ... Fatal Python error: Bus error

2015-03-26 Thread Peter

Peter added the comment:

That's not a valid option on SPARC, (see 
https://gcc.gnu.org/onlinedocs/gcc/SPARC-Options.html ) the flag is only 
available on ARM it seems.

--

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



[issue23786] test_unaligned_buffers (test.test_hash.HashEqualityTestCase) ... Fatal Python error: Bus error

2015-03-26 Thread Peter

Peter added the comment:

I've compiled Python 3.3.6 using the same options (./configure 
--prefix=/usr/local --enable-shared) and build system and that passes almost 
all the tests (test_uuid fails for an ignorable reason).

Specifically test_hash passes fully:

$ LD_LIBRARY_PATH=/usr/local/src/Python-3.3.6 ./python -m test -v test_hash
== CPython 3.3.6 (default, Mar 26 2015, 15:35:36) [GCC 4.6.2]
==   Solaris-2.11-sun4v-sparc-32bit-ELF big-endian
==   /usr/local/src/Python-3.3.6/build/test_python_4539
Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, 
dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, 
verbose=0, bytes_warning=0, quiet=0, hash_randomization=1)
[1/1] test_hash
test_empty_string (test.test_hash.BytesHashRandomizationTests) ... ok
test_fixed_hash (test.test_hash.BytesHashRandomizationTests) ... ok
test_null_hash (test.test_hash.BytesHashRandomizationTests) ... ok
test_randomized_hash (test.test_hash.BytesHashRandomizationTests) ... ok
test_randomized_hash (test.test_hash.DatetimeDateTests) ... ok
test_randomized_hash (test.test_hash.DatetimeDatetimeTests) ... ok
test_randomized_hash (test.test_hash.DatetimeTimeTests) ... ok
test_hashes (test.test_hash.HashBuiltinsTestCase) ... ok
test_coerced_floats (test.test_hash.HashEqualityTestCase) ... ok
test_coerced_integers (test.test_hash.HashEqualityTestCase) ... ok
test_numeric_literals (test.test_hash.HashEqualityTestCase) ... ok
test_unaligned_buffers (test.test_hash.HashEqualityTestCase) ... ok
test_default_hash (test.test_hash.HashInheritanceTestCase) ... ok
test_error_hash (test.test_hash.HashInheritanceTestCase) ... ok
test_fixed_hash (test.test_hash.HashInheritanceTestCase) ... ok
test_hashable (test.test_hash.HashInheritanceTestCase) ... ok
test_not_hashable (test.test_hash.HashInheritanceTestCase) ... ok
test_empty_string (test.test_hash.MemoryviewHashRandomizationTests) ... ok
test_fixed_hash (test.test_hash.MemoryviewHashRandomizationTests) ... ok
test_null_hash (test.test_hash.MemoryviewHashRandomizationTests) ... ok
test_randomized_hash (test.test_hash.MemoryviewHashRandomizationTests) ... ok
test_empty_string (test.test_hash.StrHashRandomizationTests) ... ok
test_fixed_hash (test.test_hash.StrHashRandomizationTests) ... ok
test_null_hash (test.test_hash.StrHashRandomizationTests) ... ok
test_randomized_hash (test.test_hash.StrHashRandomizationTests) ... ok

--
Ran 25 tests in 1.356s

OK
1 test OK.


So any ideas what I should look for? Or perhaps it would be helpful if I posted 
config.log, etc.

--

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



[issue23786] test_unaligned_buffers (test.test_hash.HashEqualityTestCase) ... Fatal Python error: Bus error

2015-03-26 Thread STINNER Victor

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


--
nosy: +haypo

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



[issue23786] test_unaligned_buffers (test.test_hash.HashEqualityTestCase) ... Fatal Python error: Bus error

2015-03-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yes, 3.3 uses less efficient implementation.

Try to compile Python with gcc option -mno-unaligned-access.

--
nosy: +mark.dickinson

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



[issue1191964] add non-blocking read and write methods to subprocess.Popen

2015-03-26 Thread Josiah Carlson

Josiah Carlson added the comment:

Non-blocking IO returning a None on no data currently available is new to me. 
It is new to me simply because I don't recall it ever happening in Python 2.x 
with any socket IO that I ever dealt with, and socket IO is my primary source 
for non-blocking IO experience.

From my experience, reading from a socket would always return a string, unless 
the connection was closed/broken, at which point you got a bad file descriptor 
exception. Writing would return 0 if the buffer was full, or a bad file 
descriptor exception if the connection was closed/broken. The implementation 
of asyncore/asynchat at least until 3.0 shows this in practice, and I doubt 
this has changed in the intervening years since I updated those libraries for 
3.0.

My choice to implement this based on BrokenPipeError was based on reading 
Victor(haypo)'s comments from 2014-07-23 and 2014-07-24, in which he stated 
that in asyncio, when it comes to process management, .communicate() hides 
exceptions so that communication can finish, but direct reading and writing 
surface those exceptions.

I was attempting to mimic the asyncio interface simply because it made sense to 
me coming from the socket world, and because asyncio is where people are likely 
to go if the non-blocking subprocess support in subprocess is insufficient for 
their needs.

Note that I also initially resisted raising an exception in those methods, but 
Victor(haypo)'s comments changed my mind.

 Do you know a better method that would allow to distinguish between EOF (no 
 future data, ever) and would block (future data possible) without calling 
 process.poll()?

Better is subjective when it comes to API, but different? Yes, it's already 
implemented in patch #8. BrokenPipeError exception when no more data is 
sendable/receivable. A 0 or b'' when writing to a full buffer, or reading from 
an empty buffer. This API tries to be the same as the 
asyncio.subprocess.Process() behavior when accessing stdin, stdout, and stderr 
directly.

 Returning None for non blocking I/O is standard in Python.

In some contexts, yes. In others, no. The asyncio.StreamReader() coroutines 
.read(), .readline(), and .readexactly() return strings. Raw async or sync 
sockets don't return None on read. SSL-wrapped async or sync sockets don't 
return None on read. Asyncio low-level socket operations don't yield None on a 
(currently empty) read.


In the context of the subprocess module as it exists in 3.4 (and 3.5 as it is 
unpatched), the only object that returns None on read when no data is 
available, but where data *might* be available in the future, is an underlying 
posix pipe (on posix platforms) - which isn't generally used directly.

The purpose of this patch is to expose stdin, stdout, and stderr in a way that 
allows non-blocking reads and writes from the subprocess that also plays nicely 
with .communicate() as necessary. Directly exposing the pipes doesn't work due 
to API inconsistencies between Windows and posix, so we have to add a layer.

I would argue that this layer of non-blocking (Windows and posix) pipe 
abstraction has much more in common with how asyncio deals with process IO, or 
how sockets deal with IO, than it does with pipes in general (the vast majority 
of which are blocking), so I would contend that it should have a similar API 
(no returning None).

That said, considering that the expected use of non-blocking subprocess 
communication *does not* include using a multiplexer (select, poll, etc.), I 
have the sense that a few other higher-level methods might be warranted to ease 
use substantially, and which I would expect people would end up using much more 
often than the lower-level direct read/write operations (different names might 
make more sense here):
.write_all(data, timeout=None)
.read_available(bufsize=-1) (and .read_stderr_available)
.read_exactly(bufsize, timeout=None) (and .read_stderr_exactly)

--

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



[issue23550] Add to unicodedata a function to query the Quick_Check property for a character

2015-03-26 Thread Hammerite

Hammerite added the comment:

Here is a new patch. This version addresses several issues raised in review by 
Ezio Melotti and Berker Peksag. Where I have not (yet) addressed an issue, I 
have explained why not in my previous post.

I attempted to preview my changes to the documentation that are new in this 
patch, but processing the documentation seems to be quite an involved process, 
so I have not done this in the end. Therefore there might be syntax errors or 
other issues with the documentation changes in unicodedata.rst.

--
Added file: http://bugs.python.org/file38705/quick_check_3.patch

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



[issue23676] Add support of UnicodeTranslateError in standard error handlers

2015-03-26 Thread STINNER Victor

STINNER Victor added the comment:

Serhiy Storchaka added the comment:
 str.encode, bytes.decode and str.translate are unrelated to 
 UnicodeTranslateError. But str.transform could be.

Can you please give an example of Python code to show your change?

--

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



[issue23648] PEP 475 meta issue

2015-03-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b7c0137cccbe by Victor Stinner in branch 'default':
Issue #23648: Document the PEP 475 in the Porting to Python 3.5 section and
https://hg.python.org/cpython/rev/b7c0137cccbe

--
nosy: +python-dev

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



[issue23786] test_unaligned_buffers (test.test_hash.HashEqualityTestCase) ... Fatal Python error: Bus error

2015-03-26 Thread Christian Heimes

Christian Heimes added the comment:

I'm puzzled about the segfault. I'm pretty sure that I've compiled and tested 
the code on big endian machines as well as a SPARC machines that doesn't allow 
unaligned memory access. The FNV code copies the blocks to an aligned buffer to 
prevent exactly this bug. Serhiy spent days to optimize the code as humanly 
possible.

Please recompile Python again. This time create a debug build (--with-pydebug) 
and use the default hash function FNV for your platform. The debug build helps 
to pin point the bug.

--

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



[issue23611] Pickle nested names with protocols 4

2015-03-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Pickle is backward compatible and Python 2 usually is able to unpickle data 
pickled by Python 3 with protocol  3. The patch doesn't break compatibility. 
Current default protocol is 3 for compatibility with older Python 3 versions. 
It is used in multiprocessing and this is not configurable.

--

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



[issue23676] Add support of UnicodeTranslateError in standard error handlers

2015-03-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

str.encode, bytes.decode and str.translate are unrelated to 
UnicodeTranslateError. But str.transform could be.

--

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



[issue23676] Add support of UnicodeTranslateError in standard error handlers

2015-03-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

issue18814

--

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



[issue23637] Warnings error with non-ascii chars.

2015-03-26 Thread STINNER Victor

STINNER Victor added the comment:

 Only thing required to make this work is add u in front of the message so 
 it is unicode.

The warnings module works with non-ASCII characters if you only use bytes 
strings. I'm not sure that we should enhance it to support the unicode type in 
some fields, and bytes fields in other fields.

This issue was already fixed in Python 3 with the global switch to Unicode by 
default for all strings.

I would prefer to not fix this issue.

Since it looks to a new feature, it's also not a good practice to add new 
features in minor python versions (2.7.x).

--
nosy: +haypo

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



[issue18828] urljoin behaves differently with custom and standard schemas

2015-03-26 Thread Martin Panter

Martin Panter added the comment:

If necessary, we can add a new non_relative list, rather than changing 
non_hierarchical. The repository history shows that “non_hierarchical” was 
updated with new schemes once or twice, but has never been used since it was 
added to Python as “urlparse.py”.

IMAP, WAIS and Gopher URLs can have extra components added using slashes, which 
satisfies my idea of “hierarchical”. For IMAP, I think this is explicitly 
mentioned in the RFC: https://tools.ietf.org/html/rfc5092#section-7. For 
WAIS, the hierarchy is not arbitrary, but your resulting URL 
wais://f...@bar.com/newpath probably matches the 
wais://host:port/database URL form, and I am not proposing to change that 
behaviour.

--

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



[issue23611] Pickle nested names with protocols 4

2015-03-26 Thread STINNER Victor

STINNER Victor added the comment:

Hum, I don't know well the pickle module. Is it backward compatible? Should 
Python 2 be able to unserialize data serialized by Python 3? If yes, can you 
patch break this compatibility?

It is unclear to me if it makes sense to even modify protocols different than 
the latest version.

--
nosy: +haypo

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



[issue23637] Warnings error with non-ascii chars.

2015-03-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The problem is that the warnings module works with unicode message almost all 
time except rare circumstances. So for sure this feature is used in many 
programs and it works for authors and most of users. An exception can be 
considered as a bug.

--

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



[issue13322] buffered read() and write() does not raise BlockingIOError

2015-03-26 Thread Martin Panter

Martin Panter added the comment:

See also Issue 1191964, discussing inconsistencies and how to differentiate the 
four non-blocking special results in a new API:

* read signals permanent EOF
* read signals no data temporarily available
* write signals a permanently broken pipe or connection
* write signals no buffer space temporarily available

--

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



[issue1191964] add non-blocking read and write methods to subprocess.Popen

2015-03-26 Thread Martin Panter

Martin Panter added the comment:

Yes, I think the special return value of None is only standard to the “io” 
module, which was added in Python 2.6 and 3. And even there it is inconsistent.

For what it’s worth, don’t have strong opinions on the special non-blocking and 
broken pipe cases, as long as they can be differentiated. So the current 
situation is fine by me. Just that potentially surprising differences with 
other APIs [e.g. read() - b means empty buffer, not closed pipe] need 
documenting.

The asyncio.StreamReader.read() etc methods are documented as coroutines, so 
the problem of differentiating an empty buffer from a closed pipe does not 
exist there.

Just a thought: would it make sense for these methods to be decoupled from the 
subprocess class, and generalized to apply to any pipes, as a kind of Windows 
vs POSIX abstraction layer? Then you wouldn’t have to add duplicate methods 
like read_stderr_available() and read_stderr_exactly() all the time. You might 
also have a more portable way of doing non-blocking reads from sys.stdin, etc 
as well.

--

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



[issue4944] os.fsync() doesn't work as expect in Windows

2015-03-26 Thread Emil Styrke

Emil Styrke added the comment:

I have experienced this issue with Python 2.7.8 and 2.7.9.  It is almost the 
same issue as the OP experiences as far as I can tell: spawn some Python 
threads that each create a file, flush, fsync, close, then start a subprocess 
which uses the file through the Windows API.  One thing that may differ is that 
I create the file and spawn the child from the same thread.

I tried with close_fds=True, and it indeed works then, but like the OP, in my 
production code I need to get the output from the process, so it is not a 
usable workaround for me.

Test script and child program code is available at 
https://gist.github.com/anonymous/5d7d198cd3c22b31fa2a (the file upload button 
doesn't work for me it seems).  Running the script on my machine will print at 
least one failure most of the time, but not always.

--
nosy: +Emil.Styrke
versions: +Python 2.7

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



[issue23776] Don't use assert for checking arguments in pprint

2015-03-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset bf570ff87c60 by Serhiy Storchaka in branch 'default':
Issue #23776: Removed asserts from pprint.PrettyPrinter constructor.
https://hg.python.org/cpython/rev/bf570ff87c60

--
nosy: +python-dev

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



[issue23775] Fix pprint of OrderedDict

2015-03-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset afc21da5935f by Serhiy Storchaka in branch 'default':
Issue #23775: pprint() of OrderedDict now outputs the same representation
https://hg.python.org/cpython/rev/afc21da5935f

--
nosy: +python-dev

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



[issue23776] Don't use assert for checking arguments in pprint

2015-03-26 Thread Serhiy Storchaka

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


--
resolution:  - fixed
stage: commit review - resolved
status: open - closed

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



[issue23776] Don't use assert for checking arguments in pprint

2015-03-26 Thread Serhiy Storchaka

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


--
versions:  -Python 2.7, Python 3.4

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



[issue23775] Fix pprint of OrderedDict

2015-03-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your review Berker.

--
resolution:  - fixed
stage: commit review - resolved
status: open - closed

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



[issue15133] tkinter.BooleanVar.get() behavior and docstring disagree

2015-03-26 Thread Serhiy Storchaka

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


--
assignee:  - serhiy.storchaka

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



[issue15133] tkinter.BooleanVar.get() behavior and docstring disagree

2015-03-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What are your thoughts about the patch Terry?

--

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



[issue2175] Expat sax parser silently ignores the InputSource protocol

2015-03-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Updated to the tip, added whatsnew entry and fixed the documentation.

What parts of this patch besides tests are worth to be applied to maintained 
releases?

--
Added file: http://bugs.python.org/file38696/sax_character_stream_3.patch

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



[issue2174] xml.sax.xmlreader does not support the InputSource protocol

2015-03-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Issue2175 has a patch that covers all three issues: issue1483, issue2174 and 
issue2175. I hesitate what parts of the patch are worth to be applied to 
maintained releases.

--
nosy: +serhiy.storchaka

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



[issue22721] pprint output for sets and dicts is not stable

2015-03-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ping.

--

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



[issue23780] Surprising behaviour when passing list to os.path.join.

2015-03-26 Thread Florian Bruhin

New submission from Florian Bruhin:

I just accidentally passed a list (instead of unpacking it) to os.path.join. I 
was surprised when it just returned the list unmodified:

 os.path.join([1, 2, 3])
[1, 2, 3]

Looking at the source, it simply returns the first argument (path = a; ...; 
return path) when the '*p' part is empty.

I think a genericpath._check_arg_types('join', a) or similiar should be added 
at the top, or it should ensure the *p part is not empty (as the docstring 
says two or more pathname components).

--
components: Library (Lib)
messages: 239314
nosy: The Compiler, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Surprising behaviour when passing list to os.path.join.
type: behavior
versions: Python 3.4

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



[issue23484] SemLock acquire() keyword arg 'blocking' is invalid

2015-03-26 Thread Davin Potts

Davin Potts added the comment:

Attaching patches for 3.5/default, 3.4, and 2.7 which update the documentation 
on multiprocessing.Lock, RLock, Semaphore, and BoundedSemaphore to describe 
their actual implemented behavior, replacing the existing, misleading claim 
that they are clones of threading.Lock, etc., respectively.

Specific changes:
* Lock and RLock now have their acquire and release methods drawn out so as to 
best explain the significant behavioral differences (versus threading) in 
return values, potential exceptions being raised, and passing arguments.
* Semaphore and BoundedSemaphore are not as drawn out because their behaviors 
are indeed the same in every regard except for the difference in 
block-vs-blocking (and in the case of 2.7, timeout is novel in multiprocessing 
and doesn't appear until 3.2 in threading).
* In 3.4 and 3.5, the inaccurate note block at the end of the synchronization 
section no longer misrepresents the treatment of the timeout argument in 
threading analogs.

It is worth noting that in 3.x, the behavior around the timeout argument in 
multiprocessing.{Lock,RLock,Semaphore,BoundedSemaphore} already matches that of 
threading.Semaphore and BoundedSemaphore.  The threading module appears 
inconsistent in its use of the timeout argument when comparing 
Semaphore/BoundedSemaphore with Lock/RLock.  It would be interesting to 
investigate whether in 3.x this inconsistency within threading could be brought 
in line with the rest of multiprocessing.

In issue21342 the notion of unifying the implementations of these 
synchronization primitives across threading and multiprocessing is suggested.  
If that is pursued, it would reasonably be attempted on default/3.5 and not 
backported to 2.7 (nor probably 3.4).  Thus this patch to update the 
documentation is still highly valuable for 2.7 and 3.4 and 3.5 (at least until 
such time as a unification effort might be undertaken in the case of 3.5).

--
keywords: +patch
stage: needs patch - patch review
Added file: 
http://bugs.python.org/file38702/issue_23484_doc_locks_py35_and_py34.patch

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



[issue23780] Surprising behaviour when passing list to os.path.join.

2015-03-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Error message for ntpath is improved in 3.5.

 import ntpath
 ntpath.join([1, 2, 3])
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/serhiy/py/cpython/Lib/ntpath.py, line 111, in join
genericpath._check_arg_types('join', path, *paths)
  File /home/serhiy/py/cpython/Lib/genericpath.py, line 143, in 
_check_arg_types
(funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'list'

I'm not sure that the case of single argument in posixpath.join needs a fix. 
First, any argument checks have a cost. Second, currently os.path works with 
string-like objects if they implement enough string methods.

But David's proposition looks enough harmless (but this line should be added 
inside the try block). Do you want to add tests David? If apply it to 
posixpath, it should by applied to ntpath too, because currently ntpath.join 
doesn't raise an exceptions for empty list.

 (aside: the isinstance check in _get_sep looks like a bug report waiting to 
 happen...it will do the wrong thing if passed a bytearray or memoryview...)

It is documented that os.path only works with strings and bytes objects. It 
also can work with str-like objects if lucky.

--

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



[issue23780] Surprising behaviour when passing list to os.path.join.

2015-03-26 Thread R. David Murray

R. David Murray added the comment:

No, I'm not going to write tests...my goal is to commit other people's patches, 
and I haven't even found time for that lately.  And like you, I'm not convinced 
the fix is needed.  There is one argument I can think  of in favor, though: 
currently code that doesn't raise an error on posix will raise an error on 
Windows, and there is some portability value in making this consistent.

(Side note: the fact that join works with things that look enough like strings 
is important, because I'm sure that there are pathlib-like libraries out there 
that pretend to be strings so that they can be used in things like path.join.)

--

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



[issue9698] When reusing an handler, urllib(2)'s digest authentication fails after multiple regative replies

2015-03-26 Thread SpaceOne

Changes by SpaceOne pyt...@florianbest.de:


--
nosy: +spaceone

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



[issue23602] Implement __format__ for Fraction

2015-03-26 Thread Wolfgang Maier

Wolfgang Maier added the comment:

 Decimal formatting intentionally differs from float formatting, see #23460.

I see. Thanks for the pointer. What about the missing zero in the exponent ?

--

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



[issue18620] multiprocessing page leaves out important part of Pool example

2015-03-26 Thread Davin Potts

Changes by Davin Potts pyt...@discontinuity.net:


--
nosy: +rhettinger

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



[issue21085] compile error Python3.3 on Cygwin

2015-03-26 Thread Masayuki Yamamoto

Masayuki Yamamoto added the comment:

I wrote improved patch to remove the 'si_band'.  This patch modifies the 
'n_in_sequence' to conform to the number of structure members.
And I tested manually for struct_siginfo.  struct_siginfo objects builds well.
That's all for now.

$ python3.4.exe
Python 3.4.3 (default, Mar  2 2015, 22:23:56)
[GCC 4.9.2] on cygwin
Type help, copyright, credits or license for more information.
 import signal
 signal.struct_siginfo([1, 2, 3, 4, 5, 6])
signal.struct_siginfo(si_signo=1, si_code=2, si_errno=3, si_pid=4, si_uid=5, 
si_status=6)
 signal.sigwaitinfo({signal.SIGINT})
^C
signal.struct_siginfo(si_signo=2, si_code=6, si_errno=0, si_pid=3352, 
si_uid=1000, si_status=0)
 signal.alarm(1); signal.sigwaitinfo({signal.SIGALRM})
0
signal.struct_siginfo(si_signo=14, si_code=4, si_errno=0, si_pid=5816, 
si_uid=1000, si_status=1629189728)

--
nosy: +masamoto
type:  - compile error
versions: +Python 3.5
Added file: 
http://bugs.python.org/file38704/3.4-issue21085-cygwin-struct_siginfo.patch

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



[issue18828] urljoin behaves differently with custom and standard schemas

2015-03-26 Thread Demian Brecht

Demian Brecht added the comment:

 The current behaviour when no scheme is present is fairly sensible to me and 
 should not be changed to do string concatenation nor raise an exception

Agreed. Defaulting to relative behaviour makes sense as I imagine that'll be 
the general use case.

 I removed the gopher, wais, and imap schemes from the list

I'd be concerned about removing items as non_hierarchical /is/ public facing 
and it's reasonable to assume that there are libraries out there that depend on 
these. Additionally, at a glance through their respective RFCs, it seems that 
these three protocols /do/ belong in the non_hierarchical list. While WAIS and 
IMAP do use / as a delimiter, they're not hierarchical and therefore relative 
joining doesn't make sense. For example, with the following definition in mind 
(RFC4156):

wais://host:port/database/wtype/wpath

The following will result in an incorrect URL:

urljoin('wais://f...@bar.com/mydb/type/path', '/newpath')


 However I am still not really convinced that my first urljoin-scheme.patch is 
 a bad idea. Do people actually use urljoin() with these schemes like mailto 
 in the first place?

I'd be inclined to agree that it's far from common practice. That said, I did 
find one instance of a project that seems to depend on current behaviour 
(although it's only in tests and I haven't looked any deeper): 
https://github.com/chfoo/wpull/blob/32837d7c5614d7f90b8242e1fbb41f8da9bc7ce7/wpull/url_test.py#L637.
 I imagine that the current behaviour may possibly be useful for utilities such 
as web crawlers. In light of that and the fact that the urllib.parse docs 
currently has a list of protocols that are intended to be supported across the 
entire module's API, I think that it's important to not break backwards 
compatibility in cases where the relative URL would have been returned. Your 
second patch seems to have this behaviour which I think is preferable.

--

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



[issue23785] Leak in TextIOWrapper.tell()

2015-03-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Just reading the code that uses PyErr_Restore(). I found 3 issues and may be 
the fourth in sqlite (it is more complicate than other 3).

--

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



[issue23602] Implement __format__ for Fraction

2015-03-26 Thread Stefan Krah

Stefan Krah added the comment:

The zero isn't missing. :)  We are following 
http://speleotrove.com/decimal/decarith.html, with thousands of test cases.

We could decide to do something special for g, but there are good reasons not 
to do that.

--

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



[issue23780] Surprising behaviour when passing list to os.path.join.

2015-03-26 Thread R. David Murray

R. David Murray added the comment:

Python's philosophy is one of duck typing, which means that in general we just 
let the functions fail with whatever error they produce when the in put 
datatype is wrong.  The error message in this case is fairly straightforward: 
you passed a list and it says that that data type doesn't work.  The linux case 
is a bit more problematic in that it *doesn't* produce an error for invalid 
input.  The problem there is that we can't raise an error if there's only one 
argument for backward compatibility reasons: there almost certainly exists code 
that depends on single argument path returning the argument.  

In theory there shouldn't be code that depends on that single argument being an 
incorrect data type, but it would still only be something we'd consider 
changing in a feature release.

I'm not sure it is worth fixing, frankly, but I've attached a patch we could 
consider applying to 3.5.  (aside: the isinstance check in _get_sep looks like 
a bug report waiting to happen...it will do the wrong thing if passed a 
bytearray or memoryview...)

There may be others who will advocate for a stricter type check or a try/except 
with a better error message...I'd be OK with the better error message as long 
as it doesn't break the duck typing rule.

--
keywords: +patch
nosy: +r.david.murray
Added file: http://bugs.python.org/file38701/join_datatype_check.patch

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



[issue23602] Implement __format__ for Fraction

2015-03-26 Thread Stefan Krah

Stefan Krah added the comment:

Decimal formatting intentionally differs from float formatting, see #23460.

--

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



[issue23484] SemLock acquire() keyword arg 'blocking' is invalid

2015-03-26 Thread Davin Potts

Changes by Davin Potts pyt...@discontinuity.net:


--
nosy: +rhettinger

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



[issue23784] Reloading tokenize module leads to error

2015-03-26 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
resolution: fixed - duplicate
superseder:  - Reloading tokenize breaks tokenize.open()

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



[issue23484] SemLock acquire() keyword arg 'blocking' is invalid

2015-03-26 Thread Davin Potts

Changes by Davin Potts pyt...@discontinuity.net:


Added file: http://bugs.python.org/file38703/issue_23484_doc_locks_py27.patch

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



[issue23602] Implement __format__ for Fraction

2015-03-26 Thread Wolfgang Maier

Wolfgang Maier added the comment:

actually, I'm not sure whether formatting Decimals gives correct output under 
all conditions (correctly rounded yes, but maybe not formatted correctly?).

compare:

 format(float('1.481e-6'),'.3g')
'1.48e-06'

 format(Decimal('1.481e-6'),'.3g')
'0.0148'

 format(float('1.481e-7'),'.3g')
'1.48e-07'

 format(Decimal('1.481e-7'),'.3g')
'1.48e-7'

So with the 'g' specifier the switch between floating point and scientific 
notation seems to be broken.
Also note the slightly different formatting of the exponent: the leading zero 
is missing for all specifiers, i.e. 'g', 'G', 'e', 'E'.

Are these bugs ?

--
nosy: +wolma

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