[issue26358] mmap.mmap.__iter__ is broken (yields bytes instead of ints)

2016-04-28 Thread Xiang Zhang

Xiang Zhang added the comment:

I tried to write a patch to make mmap behave like bytearray more. Making 
iteration returns int is easy. But I am trapped in the contains operation. To 
support operation like b'aa' in b'aabbcc', we have to do a str in str search. I 
don't find any portable way except writing my own. bytes and bytearray use 
stringlib_find, but that is not reachable in a c module. Any advice?

--

___
Python tracker 

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



[issue10436] tarfile.extractfile in "r|" stream mode fails with filenames or members from getmembers()

2016-04-28 Thread Martin Panter

Martin Panter added the comment:

David, if you are still interested, I think specific suggestions or patches 
would be welcome (even if Lars assigned this to himself five years ago). I also 
like the idea of separate low-level and random access layers (I also thought of 
this).

One other problem with the documentation of this mode is it points to the 
Examples section, but it is not obvious why. The only example specific to 
non-seeking mode was removed in r63411, apparently because it was obsolete:

The _only_ way to extract an uncompressed tar stream from “sys.stdin”:

tar = tarfile.open(mode="r|", fileobj=sys.stdin)
for tarinfo in tar:
tar.extract(tarinfo)

--
nosy: +martin.panter

___
Python tracker 

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



[issue23453] Clarify bytes vs text with non-seeking tarfile stream

2016-04-28 Thread Martin Panter

Martin Panter added the comment:

Looks like the _Stream docstring needs a similar fix regarding stdin and 
stdout. Also, it wouldn’t hurt to specify that the read() and write() methods 
should work with bytes, not text.

--
title: Opening a stream with tarfile.open() triggers a TypeError: can't concat 
bytes to str error -> Clarify bytes vs text with non-seeking tarfile stream
versions: +Python 3.5, Python 3.6 -Python 3.4

___
Python tracker 

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



[issue26439] ctypes.util.find_library fails when ldconfig/glibc not available (e.g., AIX)

2016-04-28 Thread Martin Panter

Martin Panter added the comment:

The obvious (but easy to fix) problem I forsee with Python 3 is the print() 
calls. If you use print("") and print(arg), that will work with both 2 and 3. 
There may be more complications with bytes vs text stdout if we change the 
os.popen() calls to use subprocess.Popen.

I didn’t mean to use libpython2.7 specifically. Substitute any shared library 
that is widely available across platforms; maybe “crypto” is a better example. 
CDLL(find_library("crypto")) loads "libcrypto.so.1.0.0" on my Linux computer. 
It looks like you got the equivalent working for AIX; I was just checking.

FWIW it looks like your parsing of sys.executable to find library search paths 
is similar to searching the runpath (or RPATH) on ELF files, as proposed in 
Issue 19317. And it seems AIX’s LIBPATH environment variable is similar to 
LD_LIBRARY_PATH on Linux, proposed to be searched in Issue 9998. Also, I 
understand the equivalent OS X environment variables 
DYLD_(FALLBACK)_LIBRARY_PATH are already used.

--

___
Python tracker 

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



[issue26826] Expose new copy_file_range() syscal in os module.

2016-04-28 Thread Martin Panter

Martin Panter added the comment:

Yes, having a high-level version of copy_file_range() that falls back to 
copyfileobj() should be okay. I’m not sure if it should be a public API of 
shutil, or just an internal detail.

I am wondering if it would be nice to rearrange the os.copy_file_range() 
signature and make more parameters optional, or is that getting too high level?

copy_file_range(in, out, count, offset_in=None, offset_out=None, flags=0)

copy_file_range(f1, f2, size)  # Try to copy a whole file
copy_file_range(f1, f2, 30, 100, 200)  # Try 30 bytes at given offsets

Also left some more review comments. Also, we should eventually add test 
case(s) for the new functionality, and an entry to Doc/whatsnew/3.6.rst.

--
stage:  -> patch review

___
Python tracker 

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



[issue26878] Allow doctest to deep copy globals

2016-04-28 Thread Steven D'Aprano

Steven D'Aprano added the comment:

I'm afraid I can't quite see what the problem is. If you're passing your own 
globs argument, can't you deepcopy it yourself? 

Could you show a minimal, short example demonstrating the issue please?

--
nosy: +steven.daprano
versions: +Python 3.6

___
Python tracker 

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



[issue26879] Spam

2016-04-28 Thread Zachary Ware

Changes by Zachary Ware :


--
nosy:  -Rogi
title: new message -> Spam

___
Python tracker 

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



[issue26879] Spam

2016-04-28 Thread Zachary Ware

Changes by Zachary Ware :


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

___
Python tracker 

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



[issue26879] new message

2016-04-28 Thread Ethan Furman

Changes by Ethan Furman :


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

___
Python tracker 

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



[issue26879] new message

2016-04-28 Thread Rogi

New submission from Rogi:

Hello!

You have a new message, please read 

r...@linuxmail.org

--
messages: 264455
nosy: Rogi
priority: normal
severity: normal
status: open
title: new message

___
Python tracker 

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



[issue26877] tarfile use wrong code when read from fileobj

2016-04-28 Thread Марк Коренберг

Марк Коренберг added the comment:

The same in tarfile.copyfileobj()

--

___
Python tracker 

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



[issue26878] Allow doctest to deep copy globals

2016-04-28 Thread DqASe

DqASe added the comment:

Alternatively, add an option like deepglobs={...} . The dictionary argument 
would be deep-copied at each test and added to the environment.

--

___
Python tracker 

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



[issue26878] Allow doctest to deep copy globals

2016-04-28 Thread DqASe

Changes by DqASe :


--
components: +Tests -Library (Lib)

___
Python tracker 

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



[issue26878] Allow doctest to deep copy globals

2016-04-28 Thread DqASe

New submission from DqASe:

Currently doctest makes shallow copies of the environment or globs argument.  
This is somewhat un-symmetrical: on the one hand, a test cannot see variables 
created by another, but on the other, it can alter mutable objects.  This is 
inconvenient e.g. when documenting several methods that change an object (say, 
obj.append() , then obj.insert() - one would hope that the results are 
independent on the order tests are executed ).

An option to make deep copies of the variables in the context, instead of 
shallow ones, would in my opinion solve the issue cleanly.

--
components: Library (Lib)
messages: 264452
nosy: DqASe
priority: normal
severity: normal
status: open
title: Allow doctest to deep copy globals
type: enhancement

___
Python tracker 

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



[issue26877] tarfile use wrong code when read from fileobj

2016-04-28 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +lars.gustaebel

___
Python tracker 

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



[issue26439] ctypes.util.find_library fails when ldconfig/glibc not available (e.g., AIX)

2016-04-28 Thread Michael Felt

Michael Felt added the comment:

I have not looked specifically, at least not that I remember, for differences 
in util/ctypes in python2 and python3. Will do so tomorrow.

I did just look briefly at the library, rather archive, built by default as 
libpython2.7.a - it is static members only, i.e., my build using xlc (i.e., not 
using gcc) does not build a shared object, so cdll.LoadLibrary and/or 
find_library will not find anything for python2.7.. Neither will m, or libm, on 
a default AIX system (with no other gcc based packages installed - these also 
install a gnu rte where the utilities and libs you mention might include.

The few python packages I have found, packaged by others, tend to reload 
everything yet again, not depending on anything that may already be there. And 
to use shared libraries they are extracting the members from the .a archives 
into two directories - when they support both 32 and 64-bit targets.

My intent is to examine the program to discover where libraries should be and 
find the member name that is most likely. Also, if LIBPATH is defined, those 
directories are searched first for a match.

In short, the key difference is to look at the program (probably python) for 
the blibpath string in the application as well as python (from memory, sys.* 
calls) to build a list of directories to search.

findLibrary('foo') first finds libfoo.a, then looks in libfoo.a for shr*.o 
members, libfoo.so, libfoo.so.X and/or libfoo.so.X.Y, etc..

I need to check that findLibrary('foo.so') continues to work. At one time it 
did, just have not looked at this for several weeks and I forget if it still 
works. That is what I shall make sure stays in the "testing" part of the patch.

Michael

--

___
Python tracker 

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



[issue26877] tarfile use wrong code when read from fileobj

2016-04-28 Thread Марк Коренберг

New submission from Марк Коренберг:

tarfile.py: _FileInFile():

(near line 687)

b = self.fileobj.read(length)
if len(b) != length:
raise ReadError("unexpected end of data")

every read() API does not guarantee that it will read `length` bytes. So, if 
fileobj reads less than requestedm that is not an error (!)

In my case it was a pipe...

--
components: Library (Lib)
messages: 264450
nosy: mmarkk
priority: normal
severity: normal
status: open
title: tarfile use wrong code when read from fileobj
type: behavior
versions: Python 3.5

___
Python tracker 

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



[issue26876] Extend MSVCCompiler class to respect environment variables

2016-04-28 Thread Steve Dower

Steve Dower added the comment:

I'm neutral about applying it to 2.7, though I can see the value in doing so.

For 3.5 it definitely has to modify _msvccompiler - the other two modules are 
just left behind to distract people apparently :) (but actually in case someone 
accidentally(?) too a direct dependency on an undocumented class).

One thing I'd like to see is an environment variable to switch it on - probably 
DISTUTILS_USE_SDK is fine for this. In the default case, we know exactly where 
we are looking for the tools, and so we know what they are called. If you're 
intending to override this completely, you probably need to override 
everything, and DISTUTILS_USE_SDK is the flag for this.

--

___
Python tracker 

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



[issue26876] Extend MSVCCompiler class to respect environment variables

2016-04-28 Thread Zachary Ware

Zachary Ware added the comment:

I can't seem to get the patch to apply, could you please regenerate it against 
a fresh checkout of https://hg.python.org/cpython#default (or 'master' of 
github.com/python/cpython)?

This looks fairly straightforward, but I'm far from an expert on distutils :).  
I can see issues arising from attempts to use a compiler/linker/etc. that 
doesn't recognize options that we assume are going to cl/link/etc., but I'm not 
sure how big a deal that is: I'd be inclined to say that if you're trying to 
tell distutils where cl is, don't get mad when what you told it doesn't work.

Also, I don't think Lib/distutils/msvccompiler.py is used anymore, but rather 
Lib/distutils/_msvccompiler.py in 3.5+.

I'm generally in favor of this, but would feel much better about it with buy-in 
from Steve.

There has also been mention of creating a new ICCCompiler class, but I'm not 
sure whether that has gotten anywhere.

--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden
stage:  -> patch review

___
Python tracker 

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



[issue26876] Extend MSVCCompiler class to respect environment variables

2016-04-28 Thread Zachary Ware

Changes by Zachary Ware :


--
nosy: +christopher.hogan

___
Python tracker 

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



[issue22477] GCD in Fractions

2016-04-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Is there something to do with this issue?

--
nosy: +serhiy.storchaka
status: open -> pending

___
Python tracker 

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



[issue26875] mmap doc gives wrong code example

2016-04-28 Thread Zachary Ware

Zachary Ware added the comment:

Thanks for the report and patch!

--
nosy: +zach.ware
versions: +Python 3.5, Python 3.6

___
Python tracker 

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



[issue26875] mmap doc gives wrong code example

2016-04-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5c8e1b98dc3f by Zachary Ware in branch '3.5':
Issue #26875: Fix mmap example
https://hg.python.org/cpython/rev/5c8e1b98dc3f

New changeset aaf2ad84ae1c by Zachary Ware in branch 'default':
Closes #26875: Merge with 3.5
https://hg.python.org/cpython/rev/aaf2ad84ae1c

--
nosy: +python-dev
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue26873] xmlrpclib raises when trying to convert an int to string when unicode is available

2016-04-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Proposed patch makes xmlrpc unmarshaller to be more strong and raise ValueError 
instead of returning incorrect value when encounters with unsupported value 
type. The unmarshaller still skips unknown tags silently if they are occurred 
outside of the "value" element.

--
keywords: +patch
stage: needs patch -> patch review
versions: +Python 3.5, Python 3.6
Added file: http://bugs.python.org/file42643/xmlrpc_unsupported.patch

___
Python tracker 

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



[issue26874] Docstring error in divmod function

2016-04-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5a578ec4b3b3 by Zachary Ware in branch '2.7':
Issue #26874: Simplify the divmod docstring.
https://hg.python.org/cpython/rev/5a578ec4b3b3

New changeset 3edf8aa1ed97 by Zachary Ware in branch '3.5':
Issue #26874: Simplify the divmod docstring
https://hg.python.org/cpython/rev/3edf8aa1ed97

New changeset c6e285789963 by Zachary Ware in branch 'default':
Closes #26874: Merge with 3.5
https://hg.python.org/cpython/rev/c6e285789963

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

___
Python tracker 

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



[issue26874] Docstring error in divmod function

2016-04-28 Thread Zachary Ware

Zachary Ware added the comment:

If only I had reloaded the page before pushing...

Btw, this was first reported in issue1209411, but only the docs were changed, 
not the docstring.

--
nosy: +zach.ware
resolution: fixed -> 
stage: resolved -> 
status: closed -> open

___
Python tracker 

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



[issue26874] Docstring error in divmod function

2016-04-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fb49082a75d1 by Zachary Ware in branch '2.7':
Issue #26874: Make divmod docstring and full doc match
https://hg.python.org/cpython/rev/fb49082a75d1

New changeset ef193be5c3cd by Zachary Ware in branch '3.5':
Issue #26874: Fix divmod docstring
https://hg.python.org/cpython/rev/ef193be5c3cd

New changeset 28c89ebd6e5a by Zachary Ware in branch 'default':
Closes #26874: Merge with 3.5
https://hg.python.org/cpython/rev/28c89ebd6e5a

--
nosy: +python-dev
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue26874] Docstring error in divmod function

2016-04-28 Thread Mark Dickinson

Mark Dickinson added the comment:

> I think it should be ((x-x%y)//y, x%y) where an integer division is used.

How about simply (x//y, x%y)?

--

___
Python tracker 

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



[issue26876] Extend MSVCCompiler class to respect environment variables

2016-04-28 Thread Rohit Jamuar

New submission from Rohit Jamuar:

The UnixCompiler class respects flags (CC, LD, AR, CFLAGS and LDFLAGS) set to 
the environment, whereas MSVCCompiler class does not. This change allows 
building CPython and any module that invokes distutils to utilize flags and 
executables that have been set to the environment. Inclusion of this change 
would ensure MSVCCompiler's behavior to be same as that of UnixCompiler and 
would also allow using a different set of compiler / linker / archiver, on 
Windows, without having the necessity for implementing separate compiler 
classes - using environment variables it should be possible to use a separate 
set of build executables - for example icl, clang, etc.

--
components: Distutils
files: msvc_respect_env_flags.patch
keywords: patch
messages: 264439
nosy: dstufft, eric.araujo, r.david.murray, rohitjamuar, zach.ware
priority: normal
severity: normal
status: open
title: Extend MSVCCompiler class to respect environment variables
type: enhancement
versions: Python 2.7, Python 3.5
Added file: http://bugs.python.org/file42642/msvc_respect_env_flags.patch

___
Python tracker 

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



[issue26874] Docstring error in divmod function

2016-04-28 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +eric.smith, lemburg, mark.dickinson, stutzbach

___
Python tracker 

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



[issue26875] mmap doc gives wrong code example

2016-04-28 Thread Xiang Zhang

New submission from Xiang Zhang:

The code given in mmap doc

import mmap

with mmap.mmap(-1, 13) as mm:
mm.write("Hello world!")

should be

mm.write(b"Hello world!")

The *b* is left out and then causes exception.

--
assignee: docs@python
components: Documentation
files: mmap_doc.patch
keywords: patch
messages: 264438
nosy: docs@python, xiang.zhang
priority: normal
severity: normal
status: open
title: mmap doc gives wrong code example
Added file: http://bugs.python.org/file42641/mmap_doc.patch

___
Python tracker 

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



[issue26874] Docstring error in divmod function

2016-04-28 Thread mbarao

mbarao added the comment:

See divmod.__doc__

--

___
Python tracker 

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



[issue26873] xmlrpclib raises when trying to convert an int to string when unicode is available

2016-04-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Minimal reproducer:

>>> xmlrpclib.loads('ab')
(({'a': 'b'},), None)

The workaround for your particular case, Nathan:

xmlrpclib.Unmarshaller.dispatch['ex:nil'] = 
xmlrpclib.Unmarshaller.dispatch['nil']

--

___
Python tracker 

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



[issue26874] Docstring error in divmod function

2016-04-28 Thread Emanuel Barry

Emanuel Barry added the comment:

The documentation looks fine to me. Are you seeing any other place that I'm 
missing?

https://docs.python.org/3/library/functions.html#divmod

--
nosy: +ebarry

___
Python tracker 

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



[issue26874] Docstring error in divmod function

2016-04-28 Thread mbarao

New submission from mbarao:

The documentation of the divmod function says that a tuple ((x-x%y)/y, x%y) is 
returned, but this is not correct anymore for python3.
I think it should be ((x-x%y)//y, x%y) where an integer division is used.

--
assignee: docs@python
components: Documentation
messages: 264434
nosy: docs@python, mbarao
priority: normal
severity: normal
status: open
title: Docstring error in divmod function
type: enhancement
versions: Python 3.5

___
Python tracker 

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



[issue26826] Expose new copy_file_range() syscal in os module.

2016-04-28 Thread Marcos Dione

Marcos Dione added the comment:

I managed to modify the congigure.ac file so it includes the proper test. after 
I run autoconf it generated the proper configure script, but I also needed to 
run autoheaders (both run by make autoconf). This last command modified a 
generated file that's in the repo, so I'm adding its diff too, but I'm not sure 
if that's ok.

--
Added file: http://bugs.python.org/file42640/copy_file_range.diff

___
Python tracker 

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



[issue26868] Document PyModule_AddObject's behavior on error

2016-04-28 Thread Berker Peksag

Changes by Berker Peksag :


--
title: Incorrect check for return value of PyModule_AddObject in _csv.c -> 
Document PyModule_AddObject's behavior on error

___
Python tracker 

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



[issue26871] Change weird behavior of PyModule_AddObject()

2016-04-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Removed changes in _decimal.c and deprecation. Used Py_XDECREF in 
_PyModule_AddObject().

--
Added file: http://bugs.python.org/file42639/pymodule_addobject_2.patch

___
Python tracker 

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



[issue26859] unittest fails with "Start directory is not importable"

2016-04-28 Thread Robert Collins

Robert Collins added the comment:

Could you please add a test case.

--
nosy: +rbcollins
stage: patch review -> test needed

___
Python tracker 

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



[issue26826] Expose new copy_file_range() syscal in os module.

2016-04-28 Thread Marcos Dione

Marcos Dione added the comment:

I'll do the copyfile() part once I'm convinced it doesn't break anything else.

--
title: Expose new copy_file_range() syscal in os module and use it to improve 
shutils.copy() -> Expose new copy_file_range() syscal in os module.

___
Python tracker 

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



[issue26826] Expose new copy_file_range() syscal in os module and use it to improve shutils.copy()

2016-04-28 Thread Marcos Dione

Marcos Dione added the comment:

> About changing copyfileobj(), here are some test cases which may help explain 
> the compatibility problems:

I see, I was expecting something like that after reading 
https://bugs.python.org/issue25063 's conclusions. I removed that part.

> Perhaps we could keep the new version as a high-level copy_file_range() 
> wrapper, but retain brute_force_copy() under the original copyfileobj() name. 
> A bit like the socket.sendfile() method vs os.sendfile().

You mean having always a copy_file_range() method that in the worst case would 
fallback to copyfileobj()? I'm considering using it to optimize copyfile() (and 
indirectly copy() and copy2()) instead. 

And sorry for the patch wrong format.

--
Added file: http://bugs.python.org/file42638/copy_file_range.diff

___
Python tracker 

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



[issue24114] ctypes.utils uninitialized variable 'paths'

2016-04-28 Thread Meador Inge

Meador Inge added the comment:

Xiang's patch LGTM.  Given that Kees has verified it, I will apply today.

--
assignee:  -> meador.inge
stage: needs patch -> commit review

___
Python tracker 

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



[issue22234] urllib.parse.urlparse accepts any falsy value as an url

2016-04-28 Thread Antti Haapala

Antti Haapala added the comment:

I do not believe there is code that would depend on `urlparse(urlstring={})` 
*not* throwing an error, since `{}` obviously is neither a URL, nor a string.

Further down the documentation explicitly states that

> The URL parsing functions were originally designed to operate on 
> character strings only. In practice, it is useful to be able to 
> manipulate properly quoted and encoded URLs as sequences of ASCII 
> bytes. Accordingly, the URL parsing functions in this module all 
> operate on bytes and bytearray objects in addition to str objects.

As the documentation does not state that it should work on any other objects, 
there shouldn't be any code that should be deprecated. Furthermore even in 3.5, 
the `bool(datetime.time(0, 0)) == False` was removed without any deprecation 
cycle, despite it having been a documented feature for more than a decade 
(unlike this one).

And IMHO not giving an object of expected type should result in a TypeError.

--

___
Python tracker 

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



[issue24114] ctypes.utils uninitialized variable 'paths'

2016-04-28 Thread Kees Bos

Kees Bos added the comment:

It's not entirely theoretical to me. I inherited some solaris boxes that cannot 
be properly maintained anymore and that have a clre program that dumps core. 
Hence no valid output and running into uninitialized 'paths'. The patch from 
Xiang Zhang will fix that.

--

___
Python tracker 

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



[issue24434] ItemsView.__contains__ does not mimic dict_items

2016-04-28 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +xiang.zhang

___
Python tracker 

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



[issue26358] mmap.mmap.__iter__ is broken (yields bytes instead of ints)

2016-04-28 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +xiang.zhang

___
Python tracker 

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



[issue24114] ctypes.utils uninitialized variable 'paths'

2016-04-28 Thread Xiang Zhang

Xiang Zhang added the comment:

Simply add one line to make the function theoretically more robust.

--
nosy: +xiang.zhang
Added file: http://bugs.python.org/file42637/issue24114.patch

___
Python tracker 

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



[issue26869] unittest longMessage docs

2016-04-28 Thread Thomas Guettler

Thomas Guettler added the comment:

Thank you for understanding my concern.



> The standard failure message for each *assert method* contains useful  
> information about the objects involved.  For example the message from 
> assertEqual shows the repr of the two unequal objects.  It is usually 
> easier to augment rather than replace this message

I think above is not needed.


> The class setting can be overridden in individual test methods by 
> assigning an instance attribute, self.longMessage, to True or False 
> before calling the assert methods.

I would add "the default value of the class gets reset before each test call". 
That is more explicit (I hope my text is what happens behind the scene)

Again, thank you, that you care.

Regards,
  Thomas Güttler

--

___
Python tracker 

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



[issue26871] Change weird behavior of PyModule_AddObject()

2016-04-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> It seems that the patch also introduces a segfault if PyLong_FromSsize_t() 
> returns NULL.

Good catch Stefan! Py_XDECREF ahould be used instead of Py_DECREF in 
_PyModule_AddObject().

--

___
Python tracker 

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



[issue26860] os.walk and os.fwalk yield namedtuple instead of tuple

2016-04-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Sorry, but I disagree with Raymond in many points.

> Classes are normally named with CamelCase.  Also, "walk_result" or 
> "WalkResult" seems like an odd name that doesn't really fit.   DirEntry or 
> DirInfo is a better match (see the OP's example, "for dir_entry in walk_it: 
> ...")

See "stat_result", "statvfs_result", "waitid_result", "uname_result", and 
"times_result". DirEntry is already used in the os module. And if accept this 
feature, needed separate types for walk() and fwalk() results.

> The "versionchanged" should be a "versionadded".

os.walk() is not new. Just it's result is changed. Class "walk_result" can be 
tagged with "versionadded", but I'm not sure there is a need to document it 
separately. The documentation of the os module already too large. 
"uname_result" and "times_result" are not documented.

> The docs and code for fwalk() needs to be harmonized with walk() so the the 
> tuple fields use the same names:  change (root, dirs, files) to (dirpath, 
> dirnames, filenames).

(root, dirs, files) is shorter than (dirpath, dirnames, filenames) and these 
names were used with os.walk() and os.fwalk() for years.

I general, I have doubts about this feature.

1. There is little backward incompatibility. At least pickle is not backward 
compatible, and I guess other serialization methods.

2. os.walk() and os.fwalk() are purposed to be used in for loop with immediate 
unpacking result tuple:

for root, dirs, files in os.walk(...):
...

Adding named tuple doesn't add any benefit for common case.

In OP case, you can either use fwalk-based implementation of walk (issue15200):

def fwalk_as_walk(*args, **kwargs):
for x in os.fwalk(*args, **kwargs):
yield x[:-1]

or just ignore the rest of tuple items:

for root, *_ in walk_it:
...

3. Using namedtuple is slower and consumes more memory than using tuple. Even 
for FS-related operation like os.walk() this can matter. A lot of code is 
optimized for exact tuples, with namedtuple this optimization is lost.

4. New names (dirpath, dirnames, filenames) are questionable. Why not use 
undersores (dir_names)? "dir" in dirpath refers to the current proceeded 
directory, but "dir" in dirnames refers to it's subdirectories. Currently you 
are free to use short names (root, dirs, files) from examples or what you 
prefer, but with namedtuple you are sticked with standard names forever. There 
are no names that satisfy everybody.

5. Third-party walk-like iterators generate tuples, so you can't use attribute 
access in too general code.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue26853] missing symbols in curses and readline modules on android

2016-04-28 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Thanks Chi Hsuan Yen and Stefan. Indeed the --with-termlib configure option 
documentation states: "When building the ncurses library, organize this as two 
parts:  the curses library (libncurses) and the low-level terminfo library 
(libtinfo)". Using --without-termlib prevents that split.

My previous comment about readelf is wrong, the gcc cross-compiler is in the 
$PATH directory search path, as well as readelf.

Closing this issue as not a bug.

--
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

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



[issue26873] xmlrpclib raises when trying to convert an int to string when unicode is available

2016-04-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you. Your server produces a response containing nonstandard type tag 
"ex:nil" [1].

authorityROLE_USER
fromDate
userId15

xmlrpclib is unable to handle this tag, and error handling is poor. xmlrpclib 
can handle only standard types and "nil" [2].

What is worse, xmlrpclib silently ignores unsupported tag and interprets 
following name "userId" as a value of the name "fromDate", and following 
userId's value 15 as next name and so forth. Your workaround doesn't help since 
the result is totally broken. You get values as keys and keys as values.

What can we do with this issue?

1. Add better handling of unsupported tags. There is a bug, xmlrpc should 
detect this case and fail instead of producing unreliable result. This is 
applicable to 2.7.

2. Add support of some Apache extension tags. This is new feature and can be 
added in 3.6 only. Not all extension tags can be supported, "ex:serializable" 
is Java specific. This is separate issue.

Martin, do you agree?

[1] http://ws.apache.org/xmlrpc/types.html
[2] 
http://web.archive.org/web/20130120074804/http://ontosys.com/xml-rpc/extensions.php

--
assignee:  -> serhiy.storchaka
nosy: +loewis
stage:  -> needs patch
type: crash -> behavior

___
Python tracker 

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



[issue26860] os.walk and os.fwalk yield namedtuple instead of tuple

2016-04-28 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Classes are normally named with CamelCase.  Also, "walk_result" or "WalkResult" 
seems like an odd name that doesn't really fit.   DirEntry or DirInfo is a 
better match (see the OP's example, "for dir_entry in walk_it: ...")

The "versionchanged" should be a "versionadded".

The docs should use "named tuple" instead of "namedtuple".  The former is the 
generic term used in the glossary to describe the instances.  The latter is the 
factory function that creates a new tuple subclass.

The attribute descriptions for the docs are pretty good.  They should also be 
applied as actual docstrings in the code as well.

The docs and code for fwalk() needs to be harmonized with walk() so the the 
tuple fields use the same names:  change (root, dirs, files) to (dirpath, 
dirnames, filenames).

--
nosy: +rhettinger

___
Python tracker 

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



[issue19317] ctypes.util.find_library should examine binary's RPATH on Solaris

2016-04-28 Thread Martin Panter

Martin Panter added the comment:

I am realizing that many people like to use find_library() as a way of 
converting a portable name like “magic” (from building with -lmagic) into a 
platform-specific name (libmagic.so.1, libmagic.dylib, magic.dll, etc), and 
then pass this to LoadLibrary() or equivalent. So searching Python’s runpath 
would probably be valid for that use case.

IMO the extra searching is inefficient, and not robust if there is more than 
one version of the library. Personally I would be more interested in adding an 
alternative function, maybe make_library_name("magic", "1") -> "libmagic.so.1", 
or cdll.LoadLibraryByPortableName("magic", "1").

--

___
Python tracker 

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