[issue26868] Incorrect check for return value of PyModule_AddObject in _csv.c

2016-04-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Testing returned value of PyModule_AddObject() is correct. This is a matter of 
style what to use: `if (...)`, `if (... == -1)` or `if (... < 0)`.

But the problem with a leak is more general. I have opened a discussion on 
Python-Dev: http://comments.gmane.org/gmane.comp.python.devel/157545 .

--
nosy: +serhiy.storchaka

___
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-27 Thread Thomas Guettler

New submission from Thomas Guettler:

The first message of the longMessage docs is confusing:

https://docs.python.org/3/library/unittest.html#unittest.TestCase.longMessage

> If set to True then 

This reads between the lines, that the default is False.

But that was long ago in Python2. In Python3 the default is True (which I 
prefer to the old default).

I think the docs should be like.

And the term "normal message" is not defined. For new comers the "normal 
message" is what I get if you don't change the default, not the behaviour of 
the Python2 version :-)

I think "normal message" should be replaced with "short message" or "diff 
message" .. I am unsure.

What do you think?

--
assignee: docs@python
components: Documentation
messages: 264359
nosy: docs@python, guettli
priority: normal
severity: normal
status: open
title: unittest longMessage docs
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



[issue26870] Unexpected call to readline's add_history in call_readline

2016-04-27 Thread Tyler Crompton

New submission from Tyler Crompton:

I was implementing a REPL using the readline module and noticed that there are 
extraneous calls to readline's add_history function in call_readline[1]. This 
was a problem because there were some lines, that, based on their compositions, 
I might not want in the history. Figuring out why I was getting two entries for 
every 

The function call has been around ever since Python started supporting GNU 
Readline (first appeared in Python 1.4 or so, I believe)[2]. This behavior 
doesn't seem to be documented anywhere.

I can't seem to find any code that depends on a line that is read in by 
call_readline to be added to the history. I guess the user might rely on the 
interactive interpreter to use the history feature. Beyond that, I can't think 
of any critical purpose for it.

There are four potential workarounds:

1. Don't use the input function. Unfortunately, this is a non-solution as it 
prevents one from using Readline/libedit for input operations.
2. Don't use Readline/libedit. For the same reasons, this isn't a good solution.
3. Evaluate get_current_history_length() and store its result. Evaluate 
input(). Evaluate get_current_history_length() again. If the length changed, 
execute readline.remove_history_item(readline.get_current_history_length() - 
1). Note that one can't assume that the length will change after a call to 
input, because blank lines aren't added to the history. This isn't an ideal 
solution for obvious reasons. It's a bit convoluted.
4. Use some clever combination of readline.get_line_buffer, tty.setcbreak, 
termios.tcgetattr, termios.tcsetattr, msvcrt.getwche, and try-except-finally 
blocks. Besides the obvious complexities in this solution, this isn't 
particularly platform-independent.

I think that it's fair to say that none of the above options are desirable. So 
let's discuss potential solutions.

1. Remove this feature from call_readline. Not only will this cause a 
regression in the interactive interpreter, many people rely on this behavior 
when using the readline module.
2. Dynamically swap histories (or readline configurations in general) between 
readline-capable calls to input and prompts in the interactive interpreter. 
This would surely be too fragile and add unnecessary overhead.
3. Document this behavior and leave the code alone. I wouldn't say that this is 
a solution, but it would at least help other developers that would fall in the 
same trap that I did.
4. Add a keyword argument to input to instruct call_readline to not add the 
line to the history. Personally, this seems a bit dirty.
5. Add a readline function in the readline module that doesn't rely on 
call_readline. Admittedly, the implementation would have to look eerily similar 
to call_readline, so perhaps there could be a flag on call_readline. However, 
that would require touching a few files that don't seem to be particularly 
related. But a new function might be confusing since call_readline sounds like 
a name that you'd give such a function.

I think that the last option would be a pretty clean change that would cause 
the least number of issues (if any) for existing code bases. Regardless of the 
implementation details, I think that this would be the best route—to add a 
Python function called readline to the readline module. I would imagine that 
this would be an easy change/addition.

I'm attaching a sample script that demonstrates the described issue.

[1]: 
https://github.com/python/cpython/blob/fa3fc6d78ee0ce899c9c828e796b66114400fbf0/Modules/readline.c#L1283
[2]: 
https://github.com/python/cpython/commit/e59c3ba80888034ef0e4341567702cd91e7ef70d

--
components: Library (Lib)
files: readline_history.py
messages: 264360
nosy: Tyler Crompton
priority: normal
severity: normal
status: open
title: Unexpected call to readline's add_history in call_readline
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file42626/readline_history.py

___
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-27 Thread Xavier de Gaye

Xavier de Gaye added the comment:

It seems to be the same bug.

Source-less distributions are useful on mobile devices where space is sparse.

--

___
Python tracker 

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



[issue26870] Unexpected call to readline's add_history in call_readline

2016-04-27 Thread Tyler Crompton

Changes by Tyler Crompton :


--
nosy: +twouters

___
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-27 Thread Marcos Dione

Marcos Dione added the comment:

> I didn’t see any changes to the configure script in your patches. Did you 
> make that change to define HAVE_COPY_FILE_RANGE yet?

I'm not really sure how to make the test for configure.ac. Other functions are 
checked differently (availability of header files), but in this case it would 
need a compile test. I will have to investigate further.

> In /Modules/posixmodule.c (all three of your patches have an indented diff 
> header, so the review doesn’t pick it up):

indented diff header?

> +#ifdef HAVE_COPY_FILE_RANGE
> +/* The name says posix but currently it's Linux only */
> 
> What name are you referring to?

Posix, The function is not Posix at all. I can remove that comment.

> +return (!async_err) ? posix_error() : NULL;
> 
> This would make more sense with the logic swapped around: async_err? NULL : 
> posix_error()

I have to be honest, I just copied it from posix_sendfile(), but I agree.

I'll answer the last paragraph when I finished understanding it, but I think 
you mean things like zipFile.

--

___
Python tracker 

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



[issue26481] unittest discovery process not working without .py source files

2016-04-27 Thread Martin Panter

Martin Panter added the comment:

Please see Issue 26859; I think it is describing the same problem, and a fix is 
proposed (although no regression test)

--
nosy: +martin.panter
resolution:  -> duplicate
status: open -> closed
superseder:  -> unittest fails with "Start directory is not importable"

___
Python tracker 

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



[issue26864] urllib.request no_proxy check differs from curl

2016-04-27 Thread Xiang Zhang

Xiang Zhang added the comment:

Thanks for your comment martin. Using re.escape is really a good advise.

--
Added file: http://bugs.python.org/file42627/issue26864_v5.patch

___
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-27 Thread Marcos Dione

Marcos Dione added the comment:

Updated the patch withe most of Martin Panter's and all vadium's comments.

--
Added file: http://bugs.python.org/file42628/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



[issue26862] SYS_getdents64 does not need to be defined on android API 21

2016-04-27 Thread Xavier de Gaye

Xavier de Gaye added the comment:

New patch taking into account Gregory's comments.
API level 19 is the last to have a sys/linux-syscalls.h header.
All levels have a android/api-level.h header that define __ANDROID_API__.
There is no API level 20, and SYS_getdents64 is defined at API level 21.

--
Added file: http://bugs.python.org/file42629/posixmodule.patch

___
Python tracker 

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



[issue26868] Incorrect check for return value of PyModule_AddObject in _csv.c

2016-04-27 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the write-up, Serhiy.

It looks like "... == -1" is more popular in the codebase (for  
PyModule_AddObject, "... < 0" is the most popular style).

Here is a patch to document the current behavior of PyModule_AddObject.

--
Added file: http://bugs.python.org/file42630/addobject_doc.diff

___
Python tracker 

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



[issue26866] Inconsistent environment in Windows using "Open With"

2016-04-27 Thread Eryk Sun

Eryk Sun added the comment:

Generally the directory that an application needs for its configuration files 
and data is either the script directory or an %AppData% or %LocalAppData% 
subdirectory. If the initial working directory matters for some reason (e.g. 
for writing output files), the parent process either changes to the desired 
directory beforehand or passes the working directory as a parameter to the 
CreateProcess or ShellExecuteEx API. It wouldn't make sense for Python to set 
the working directory to the script directory, because a standard user probably 
can't even modify that directory. 

> From Explorer:

When running a file, Explorer usually creates the child process with the 
initial working directory set to that of the target file. However, for "open 
with" it uses its own working directory, "%SystemRoot%\System32". Actually, the 
"open with" dialog (not the menu) that lets you select and run an application 
isn't even Explorer. It's openwith.exe. At least it is in Windows 10 and, IIRC, 
back to Windows 7.

A workaround is to create a "Run" command in 
"HKCU\SOFTWARE\Classes\SystemFileAssociations\.py". See the following page for 
more information about application registration:

https://msdn.microsoft.com/en-us/library/ee872121

For example, the follow .reg file defines a command to run a script using the 
py.exe launcher. It also adds an "Edit" command that uses DDE to open a script 
in Visual Studio 2015. 

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Classes\SystemFileAssociations\.py]

[HKEY_CURRENT_USER\SOFTWARE\Classes\SystemFileAssociations\.py\shell]
@="Run"

[HKEY_CURRENT_USER\SOFTWARE\Classes\SystemFileAssociations\.py\shell\Edit]

[HKEY_CURRENT_USER\SOFTWARE\Classes\SystemFileAssociations\.py\shell\Edit\command]
@="\"C:\\Program Files (x86)\\Microsoft Visual Studio 
14.0\\Common7\\IDE\\devenv.exe\" /dde"

[HKEY_CURRENT_USER\SOFTWARE\Classes\SystemFileAssociations\.py\shell\Edit\ddeexec]
@="Open(\"%1\")"

[HKEY_CURRENT_USER\SOFTWARE\Classes\SystemFileAssociations\.py\shell\Edit\ddeexec\application]
@="VisualStudio.14.0"

[HKEY_CURRENT_USER\SOFTWARE\Classes\SystemFileAssociations\.py\shell\Edit\ddeexec\topic]
@="system"

[HKEY_CURRENT_USER\SOFTWARE\Classes\SystemFileAssociations\.py\shell\Run]

[HKEY_CURRENT_USER\SOFTWARE\Classes\SystemFileAssociations\.py\shell\Run\command]
@="\"C:\\Windows\\py.exe\" \"%1\" %*"

These commands are associated directly with the .py file extension, so they'll 
always be available, even if no ProgID (e.g. Python.File) is associated with 
.py scripts. However, the shell will prefer a selected ProgID's "Run" or "Edit" 
commands, if they exist.

FYI, Explorer's "FileExts\.py" key caches the OpenWithProgids, OpenWithList, 
and the selected UserChoice for .py files. It shouldn't be modified 
programmatically, and there's actually a deny ACE on the UserChoice subkey to 
prevent setting values. One thing you can do, if necessary, is delete the 
entire key to recompute the file association from the HKCR settings.

If you're manually testing changes by directly modifying the registry (such as 
deleting the above key), you can call the shell's SHChangeNotify function to 
refresh file associations, which avoids having to log off and back on. For 
example:

import ctypes
shell32 = ctypes.WinDLL('shell32')

SHCNE_ASSOCCHANGED = 0x0800
shell32.SHChangeNotify.restype = None

shell32.SHChangeNotify(SHCNE_ASSOCCHANGED, 0, 0, 0)

> from the command prompt:

cmd spawns a process using its current working directory (displayed in the 
prompt, or returned by "cd" without an argument). This is not necessarily the 
directory of the target file. You can use the /d option of the start command to 
override this with a specific working directory. For example:

start "title" /d "C:\Temp" "C:\Temp\somescript.py"

--
nosy: +eryksun

___
Python tracker 

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



[issue26855] add platform.android_ver() for android

2016-04-27 Thread Xavier de Gaye

Xavier de Gaye added the comment:

The android/api-level.h header exists at all the android API levels and define 
__ANDROID_API__ as, for example at level 21:

#define __ANDROID_API__ 21

So it is possible to get the sdk version from here, and maybe forget about the 
release version.

--

___
Python tracker 

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



[issue26870] Unexpected call to readline's add_history in call_readline

2016-04-27 Thread Martin Panter

Martin Panter added the comment:

Solution 3 (documentation) can easily be done for existing versions of Python. 
Any other fix I think would have to be done in the next Python version (3.6).

By solution 2 (dynamically swap histories), do you mean add an API to save and 
load the entire history list somewhere, like read/write_history_file(), but 
maybe to a Python list instead?

A variation on solution 4 came to my mind: Add a global variable or function to 
the readline module to enable or disable automatic history addition. Or maybe a 
callback that is run after a line is entered, with it set to the current 
implementation by default.

If I understand solution 5 (new version of call_readline), that also seems 
reasonable. I guess you mean to add a new function to replace the Python call 
to input()? A minor downside would be that the caller has to do extra work if 
it wants to use input() when the Readline library is unavailable.

--
components: +Extension Modules -Library (Lib)
nosy: +martin.panter
versions:  -Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue22747] Interpreter fails in initialize on systems where HAVE_LANGINFO_H is undefined

2016-04-27 Thread Roman Evstifeev

Changes by Roman Evstifeev :


--
nosy: +Roman.Evstifeev

___
Python tracker 

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



[issue17905] Add check for locale.h

2016-04-27 Thread Roman Evstifeev

Changes by Roman Evstifeev :


--
nosy: +Roman.Evstifeev

___
Python tracker 

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



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

2016-04-27 Thread Roman Evstifeev

Changes by Roman Evstifeev :


--
nosy: +Roman.Evstifeev

___
Python tracker 

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



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

2016-04-27 Thread Roman Evstifeev

Changes by Roman Evstifeev :


--
nosy: +Roman.Evstifeev

___
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-27 Thread Martin Panter

Martin Panter added the comment:

FYI Martin Panter and vadmium are both me :)

I’m not a big fan or expert on configure.ac and Autoconf, but I guess in this 
case it is the simplest solution. Maybe look at some of the existing 
AC_CHECK_DECL and AC_COMPILE_IFELSE invocations. I guess you need to see if 
__NR_copy_file_range is available.

In the earlier patches, there were four space characters at the start of the 
file. In the 2016-04-27 09:16 patch, there is a completely empty line (after 
+#endif /* HAVE_COPY_FILE_RANGE */), which may also be interfering.

FWIW, I don’t think you have to have the posix_ prefix on your function if you 
don’t want it. It is a static function, so the naming is fairly unrestricted.

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

# Transcoding a file to a different character encoding
with open("input.txt", "rt", encoding="latin-1") as input, \
open("utf8.txt", "wt", encoding="utf-8") as output:
shutil.copyfileobj(input, output)

# Input is a BufferedReader and may hold extra buffered data
with open("data", "rb") as input, open("output", "wb") as output:
header = input.read(100)  # Actually reads more bytes from OS
process_header(header)
copyfileobj(input, output)  # Copy starting from offset 100

--

___
Python tracker 

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



[issue26864] urllib.request no_proxy check differs from curl

2016-04-27 Thread Martin Panter

Martin Panter added the comment:

This version looks okay to me, thanks.

--

___
Python tracker 

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



[issue26855] add platform.android_ver() for android

2016-04-27 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

Isn't this macro used in compile time? I thought android_ver() aims to check 
runtime versions.

--

___
Python tracker 

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



[issue26855] add platform.android_ver() for android

2016-04-27 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

If the file is guaranteed to exist on most modern Android platforms, this 
sounds like a good approach.

Perhaps you could add support to fallback to running getprop instead, if the 
file doesn't exist or cannot be parsed ?!

--
nosy: +lemburg

___
Python tracker 

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



[issue26868] Incorrect check for return value of PyModule_AddObject in _csv.c

2016-04-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Added comments on Rietveld.

--

___
Python tracker 

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



[issue26855] add platform.android_ver() for android

2016-04-27 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

Some screenshots showing different file contents:

 * 
http://www1-lw.xda-cdn.com/files/2013/12/tweak-your-samsung-galaxy-s3s-performance-with-these-build-prop-android-hacks.w654.jpg
 * 
http://media.apcmag.com/wp-content/uploads/sites/20/2014/04/buildprop-text-file.jpg
 * http://i.imgur.com/hZXQaX9.png

I think exposing `codename` and `incremental` may also make sense to get a 
complete picture.

`ro.product` also has a lot of useful entries which could be used for some of 
the other platform APIs such as uname().

--

___
Python tracker 

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



[issue26855] add platform.android_ver() for android

2016-04-27 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

I have a WIP patch. [1] It's based on Shiz's patch [2].

[1] 
https://github.com/yan12125/python3-android/blob/cpython-hg/mk/python/android-misc.patch
[2] 
https://github.com/rave-engine/python3-android/blob/9bb6420317922c07df405315eea040f9301f7eca/mk/python/3.4.3/python-3.4.3-android-misc.patch

--

___
Python tracker 

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



[issue26870] Unexpected call to readline's add_history in call_readline

2016-04-27 Thread Tyler Crompton

Tyler Crompton added the comment:

I agree about the documentation. It would only take a few minutes to do.

In regard to your inquiry about the second solution, more or less, yes. I left 
that one a bit ambiguous since there are many ways to skin that cat. But in 
retrospect, I probably shouldn't have included that potential solution since 
it'd be a bit goofy and wouldn't necessarily be much different (in terms of 
code conciseness) than the third workaround that I mentioned.

As for your suggestion about the fourth solution, I like that idea. I feel that 
it's actually more similar to the fifth solution than the fourth, but I feel 
that we're getting close to coming up with something that should be easy and 
effective.

Lastly, in regard to the fifth solution, yes. But I see what you're saying 
about the downside. Yeah, that would be rather annoying. For a moment, I 
thought that it could fall back to standard IO in the absence of 
Readline/libedit, but that would be a bit misleading for a function in the 
readline module. Besides, input already does that anyway.

I would imagine that in the vast majority of cases of using such a new 
function, the developer would fallback to input, because they'd likely 
prioritize getting the content from the user over ensuring Readline/libedit 
functionality. Since we already have a function that automatically does that, I 
think your suggestion to add a function to the readline module to 
enable/disable automatic history addition would be ideal. I'd be reluctant to 
use a global Python variable since it would be out of uniform with the rest of 
the members (i.e., functions) of the module.

I like the idea of adding a set_auto_history(flag=True|False) or something to 
that effect.

--

___
Python tracker 

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



[issue25788] fileinput.hook_encoded has no way to pass arguments to codecs

2016-04-27 Thread Joseph Hackman

Joseph Hackman added the comment:

Updated documentation in fileinput.rst, Doc/whatsnew/3.6.rst, Misc/NEWS and 
Misc/ACKS.

Thank you so much Serhiy for taking the time to review!

--
Added file: http://bugs.python.org/file42631/issue25788-3.patch

___
Python tracker 

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



[issue26866] Inconsistent environment in Windows using "Open With"

2016-04-27 Thread Steve Dower

Steve Dower added the comment:

Wouldn't be surprised to see differences between Win7 and Win10 - the "current 
working directory" concept has essentially been deprecated in Windows for a 
while (at least through the GUI).

Registering a system file association is something we could do for the 
launcher, but that'd be about it. I'm not sure it'd gain that much. Would be 
very interesting to collect data on who double clicks .py files vs. running 
them from another program or a console.

--

___
Python tracker 

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



[issue26866] Inconsistent environment in Windows using "Open With"

2016-04-27 Thread Tom Middleton

Tom Middleton added the comment:

I agree with your assessment Steve. I don't see there being a good fix to this. 
I also think it would be a bad idea to have the launcher change the current 
working directory.
Example:
c:\foo\> python d:\scripts\bar.py myfile
(where myfile is in c:\foo\)

A kludge work around in a script is something like this:
import os

if __name__ == "__main__":
os.chdir(os.path.dirname(__file__))


I also don't think it makes sense to counteract what seems to be a Windows 
issue in python (or the launcher of which I am less familiar with). I was 
hoping it was going to be a simple registry setting or something like that 
which could be handled in the install process.


Eryk, you are correct, it was poor coding that led to the issue. I don't think 
I was clear in my initial post that I realize that opening a file and assuming 
the directory of the script is the cwd is not good practice. I was commenting 
that it is inconsistent between launching methods. I was launching a script 
that was attempting to write a log file using the logging module with a 
relative path filename. It was a gotcha because it worked fine on my desktop 
and it wasn't working when a colleague ran it from "Open with". I've since 
improved my methodology so the issue is moot for that regard.
However, it is still interesting that there is an inconsistency in Windows in 
those methods of execution. FWIW I also tested it out with perl and as I 
expected, got the same results of working directories.

Also please note that I am working in Python 2.7, there is no py launcher as 
there is in 3. I am not certain what inconsistencies may occur between calling 
py.exe v. python.exe.

--

___
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-27 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Replace existing description with

"This class attribute determines what happens when a custom failure message is 
passed as the msg argument to an assertXYY call that fails.  If True, the 
default, the custom message is appended to the end of the standard failure 
message.  If False, the custom message replaces the standard message.

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

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.

New in version 3.1."

--
nosy: +terry.reedy
stage:  -> needs patch
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



[issue26664] find a bug in activate.fish of venv of cpython3.6

2016-04-27 Thread Xiang Zhang

Xiang Zhang added the comment:

The patch introduced by issue26348 should be reverted. The __VENV_PROMPT__ is 
meant to be a placeholder. For example, when you create a virtual environment 
named venv-test, the __VENV_PROPMT__ will be replace by (venv-test). If the 
patch is applied, it will be $(venv-test), treated as an expression and then 
cause a failure.

--
nosy: +xiang.zhang

___
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-27 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

PyModule_AddObject() has weird and counterintuitive behavior. It steals a 
reference only on success. The caller is responsible to decref it on error. 
This behavior was not documented and inconsistent with the behavior of other 
functions stealing a reference (PyList_SetItem() and PyTuple_SetItem()). Seems 
most developers don't use this function correctly, since only in few places in 
the stdlib a reference is decrefed explicitly after PyModule_AddObject() 
failure.

This weird behavior was first reported in issue1782, and changing it was 
proposed. Related bugs in PyModule_AddIntConstant() and 
PyModule_AddStringConstant() were fixed, but the behavior of 
PyModule_AddObject() was not changed and not documented.

This issue is opened for gradual changing the behavior of PyModule_AddObject(). 
Proposed patch introduces new macros PY_MODULE_ADDOBJECT_CLEAN that controls 
the behavior of PyModule_AddObject() as PY_SSIZE_T_CLEAN controls the behavior 
of PyArg_Parse* functions. If the macro is defined before including "Python.h", 
PyModule_AddObject() steals a reference unconditionally.  Otherwise it steals a 
reference only on success, and the caller is responsible for decref'ing it on 
error (current behavior). This needs minimal changes to source code if 
PyModule_AddObject() was used incorrectly (i.e. as documented), and keep the 
code that explicitly decref a reference after PyModule_AddObject() working 
correctly.

Use of PyModule_AddObject() without defining PY_MODULE_ADDOBJECT_CLEAN is 
declared deprecated (or we can defer this to 3.7). In the distant future (after 
dropping the support of 2.7) the old behavior will be dropped.

See also a discussion on Python-Dev: 
http://comments.gmane.org/gmane.comp.python.devel/157545 .

--
components: Extension Modules, Interpreter Core
files: pymodule_addobject.patch
keywords: patch
messages: 264384
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Change weird behavior of PyModule_AddObject()
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file42632/pymodule_addobject.patch

___
Python tracker 

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



[issue26348] activate.fish sets VENV prompt incorrectly

2016-04-27 Thread Xiang Zhang

Xiang Zhang added the comment:

The original behaviour is right. __VENV_PROMPT__ is meant to be a placeholder, 
not a variable interpreted by shell. I think this patch should be reverted. 
Related issue is #26664.

--
nosy: +xiang.zhang

___
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-27 Thread Stefan Krah

Stefan Krah added the comment:

I think the current behavior is good for error handling by goto,
which is common for module initialization.

Please don't change this.

--
nosy: +skrah

___
Python tracker 

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



[issue25243] decouple string-to-boolean logic from ConfigParser.getboolean and offer as separate function

2016-04-27 Thread Joshua Bronson

Joshua Bronson added the comment:

Hi Raymond, I'm a bit confused by your comment. The patch I attached to my 
previous message adds the static method `bool.parse_config_str`. So there's no 
need to `import configparser` to use this, and "from" is no longer included in 
the proposed method name. Could you please take a look at my previous message, 
if you missed it, and reopen this if appropriate?

--

___
Python tracker 

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



[issue26868] Incorrect check for return value of PyModule_AddObject in _csv.c

2016-04-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

As for Modules/_csv.c, I think it is better to change the behavior of 
PyModule_AddObject() (issue26871). This will fix similar issues in all modules.

--
dependencies: +Change weird behavior of PyModule_AddObject()

___
Python tracker 

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



[issue25243] decouple string-to-boolean logic from ConfigParser.getboolean and offer as separate function

2016-04-27 Thread Joshua Bronson

Joshua Bronson added the comment:

Actually, looks like the version of the patch I attached did use the name 
`bool.from_config_str`, sorry about that -- I'll attach a new patch renaming 
this to `bool.parse_config_str` if there is interest in further consideration.

--

___
Python tracker 

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



[issue25243] decouple string-to-boolean logic from ConfigParser.getboolean and offer as separate function

2016-04-27 Thread Joshua Bronson

Joshua Bronson added the comment:

Though come to think of it, the issue you raised with using "from" in the 
method name wouldn't apply here, since the static method is on the bool class, 
and the method does return bool.

--

___
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-27 Thread Michael Felt

Michael Felt added the comment:

These are very different issues. However, this patch may resolve both!

ldconfig (-p if I recall) lists where (shared) libraries have been installed 
(imho, this is a GNU tool approach) - whereas AIX would use dump -H to find 
library paths embedded in a program and/or shared library.

Until this patch, to use shared libraries on AIX the members of an archive 
needed to be extracted from the .a archive, and for 64-bit members, a separate 
directory (e.g. /usr/lib64) is needed. With this patch find_library() (actually 
cdll.LoadLibrary() can load members from either both .so and .a libraries, as 
is normal for AIX.

So, in a way, this would also solve https://bugs.python.org/issue21826 as 
ldconfig is no longer needed (nor called) on AIX.

p.s. As it is well longer than a month - I would appreciate that someone 
actually look at the patch and tell me how it can be improved! :)

--

___
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-27 Thread David Edelsohn

David Edelsohn added the comment:

The most recent patch seems to follow AIX semantics correctly.

--

___
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-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Idiomatic code is

if (PyModule_AddObject(module, "name", create_new_object()) < 0)
goto error;

If you already have a reference and need to use it later:

obj = create_new_object();
... /* use obj */
Py_INCREF();
if (PyModule_AddObject(module, "name", create_new_object()) < 0)
goto error;
... /* use obj */
Py_DECREF(obj);

error:
Py_XDECREF(obj);

Many current code use above idioms, but it doesn't work as expected.

It is almost impossible to write correct code with current behavior. And 
_decimal.c is not an exception, it has leaks.

--

___
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-27 Thread Stefan Krah

Stefan Krah added the comment:

Your definition of correctness is very odd. The "leaks" you are talking
about are single references in case of a module initialization failure,
in which case you are likely to have much bigger problems.


Please take _decimal out of this patch, it's a waste of time.

--

___
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-27 Thread Stefan Krah

Changes by Stefan Krah :


--
nosy:  -skrah

___
Python tracker 

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



[issue26348] activate.fish sets VENV prompt incorrectly

2016-04-27 Thread Dan McCombs

Dan McCombs added the comment:

I somehow missed the comment on 2016-04-01, I apologize for being late to look 
at this.

Xiang is right, this patch should be reverted.

It looks like the issue reported was originally brought on by an activate.fish 
being used from a Python after the patch in commit 7f913c6ada03 was added, but 
the running version of Python did not include the patch, so that the 
placeholder was not being swapped out. In that case, updating the script to 
include $ and use the variable fixed the problem, but when the patch in 
7f913c6ada03 is also included it causes the placeholder to be swapped to a name 
wrapped in parenthesis preceded by $ at the time the venv is created causing a 
syntax error in fish.

Since the patch in commit 7f913c6ada03 swaps that place holder and handles 
doing so in the other activate scripts as well, the patch that was part of this 
issue (cfc66e37eb8e) is not needed and should be reverted.

Here's the commit adding that placeholder for context:

https://hg.python.org/cpython/rev/7f913c6ada03

--

___
Python tracker 

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



[issue26664] find a bug in activate.fish of venv of cpython3.6

2016-04-27 Thread Brett Cannon

Changes by Brett Cannon :


--
assignee:  -> brett.cannon

___
Python tracker 

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



[issue26348] activate.fish sets VENV prompt incorrectly

2016-04-27 Thread Brett Cannon

Brett Cannon added the comment:

So just to be clear, cfc66e37eb8e and 0f1ac94d2f98 should be reverted? No other 
changes?

And will this fix issue #26664 or affect it in any way?

--
assignee:  -> brett.cannon
status: closed -> open

___
Python tracker 

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



[issue26348] activate.fish sets VENV prompt incorrectly

2016-04-27 Thread Dan McCombs

Dan McCombs added the comment:

Yes, reverting cfc66e37eb8e and 0f1ac94d2f98 should resolve #26664.

--

___
Python tracker 

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



[issue26348] activate.fish sets VENV prompt incorrectly

2016-04-27 Thread Brett Cannon

Brett Cannon added the comment:

I'll revert the two commits then and close both this and #26664 when I have a 
chance.

--

___
Python tracker 

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



[issue26348] activate.fish sets VENV prompt incorrectly

2016-04-27 Thread Dan McCombs

Dan McCombs added the comment:

Thanks Brett.

--

___
Python tracker 

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



[issue25788] fileinput.hook_encoded has no way to pass arguments to codecs

2016-04-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8ab8f5259f09 by Serhiy Storchaka in branch 'default':
Issue #25788: fileinput.hook_encoded() now supports an "errors" argument
https://hg.python.org/cpython/rev/8ab8f5259f09

--
nosy: +python-dev

___
Python tracker 

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



[issue25788] fileinput.hook_encoded has no way to pass arguments to codecs

2016-04-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Committed with some changes. Thank you for your contribution Joseph.

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



[issue26872] Default ConfigParser in python is not able to load values habing percent in them

2016-04-27 Thread sorin

New submission from sorin:

The ConfigParser issue with % (percent) is taking huge proportions because it 
does have serious implications downstream. One such example is the fact that in 
breaks virtualenv in such way the if you create a virtual env in a path that 
contains percent at some point you will endup with a virtualenv where you can 
install only about 50% of existing python packages (serious ones like numpy or 
pandas will fail to install or even to perform a simple python setup.py 
egg_info on them).

This is related to distutils which is trying to use the ConfigParser to load 
the python PATH (which now contains the percent). 

Switching to RawConfigParser does resolve the problem but this seems like an 
almost impossible attempt because the huge number of occurrences in the wild.

You will find the that only class that is able to load a value with percent 
inside is RawConfigParser and I don't think that this is normal.

Here is some code I created to exemplify the defective behaviour:
https://github.com/ssbarnea/test-configparser/blob/master/tests/test-configparser.py#L21

The code is executed by Travis with multiple version of python, see one result 
example: https://travis-ci.org/ssbarnea/test-configparser/jobs/126145032

My personal impression is that the decision to process the % (percent) and to 
change the behaviour between Python 2 and 3 was a very unfortunate one. Ini/Cfg 
file specification does not specify the percent as an escape character. 
Introduction of the %(VAR) feature sounds more like bug than a feature in this 
case.

--
components: Distutils
messages: 264402
nosy: dstufft, eric.araujo, sorin
priority: normal
severity: normal
status: open
title: Default ConfigParser in python is not able to load values habing percent 
in them
type: compile error
versions: Python 3.4, Python 3.5

___
Python tracker 

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



[issue26872] Default ConfigParser in python is not able to load values habing percent in them

2016-04-27 Thread sorin

sorin added the comment:

Here is one example of failure caused by this 
https://gist.github.com/ssbarnea/b373062dd45de92735c7482b2735c5fb

--

___
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-27 Thread Stefan Krah

Stefan Krah added the comment:

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

--
nosy: +skrah

___
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-27 Thread Martin Panter

Martin Panter added the comment:

I notice the patch is against Python 2, and uses Python 2 specific syntax. I am 
unsure if this kind of change is acceptable for 2.7, or if it would have to 
only go into 3.6. Hopefully this version of the patch will notify the review 
system that it is against Python 2.

--
stage:  -> patch review
Added file: http://bugs.python.org/file42633/python.Lib.ctypes.160309.patch

___
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-27 Thread Martin Panter

Changes by Martin Panter :


Removed file: http://bugs.python.org/file42633/python.Lib.ctypes.160309.patch

___
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-27 Thread Martin Panter

Changes by Martin Panter :


Added file: http://bugs.python.org/file42634/python.Lib.ctypes.160317.patch

___
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-27 Thread Martin Panter

Martin Panter added the comment:

I don’t know anything about AIX specific stuff, but I left some general 
comments in the code review.

Is there any chance that AIX people would be relying on the current behaviour 
that I understand uses _findSoname_ldconfig() and _findLib_gcc()?

Is this new functionality covered by the test suite? E.g. in 
/Lib/ctypes/test/test_find.py, there are tests that call find_library() for GL, 
GLU, and gle. Are those libraries common on AIX?

As discussed in Issue 9998, it seems a lot of people use find_library() to help 
convert a build-time library name to a run-time shared library name that can be 
passed to CDLL() or LoadLibrary(). E.g. on Linux:

>>> find_library("python2.7")  # As used in cc . . . -lpython2.7
'libpython2.7.so.1.0'
>>> cdll.LoadLibrary("libpython2.7.so.1.0")


Does your patch support this kind of use case?

--

___
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-27 Thread Nathan Williams

New submission from Nathan Williams:

I am using xmlrpclib against an internal xmlrpc server.
One of the responses returns integer values, and it raises an exception in 
"_stringify"

The code for _stringify is (xmlrpclib.py:180 in python2.7):

if unicode:
def _stringify(string):
# convert to 7-bit ascii if possible
try:
return string.encode("ascii")
except UnicodeError:
return string
else:
def _stringify(string):
return string


So when "unicode" is available, .encode is called on the parameter (which are 
the returned objects from the server) which fails for ints.

Without the unicode path it works fine, proven with the following monkey-patch:
xmlrpclib._stringify = lambda s: s

I am using the above patch as a workaround, but a fix to the library should be 
straightforward, simply checking for AttributeError in the except clause would 
solve it while retaining the existing functionality.


The traceback:

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.6/xmlrpclib.py", line 1199, in __call__
return self.__send(self.__name, args)
  File "/usr/lib/python2.6/xmlrpclib.py", line 1489, in __request
verbose=self.__verbose
  File "/usr/lib/python2.6/xmlrpclib.py", line 1253, in request
return self._parse_response(h.getfile(), sock)
  File "/usr/lib/python2.6/xmlrpclib.py", line 1387, in _parse_response
p.feed(response)
  File "/usr/lib/python2.6/xmlrpclib.py", line 601, in feed
self._parser.Parse(data, 0)
  File "/usr/lib/python2.6/xmlrpclib.py", line 868, in end
return f(self, join(self._data, ""))
  File "/usr/lib/python2.6/xmlrpclib.py", line 935, in end_struct
dict[_stringify(items[i])] = items[i+1]
  File "/usr/lib/python2.6/xmlrpclib.py", line 176, in _stringify
return string.encode("ascii")
AttributeError: 'int' object has no attribute 'encode'

--
components: Library (Lib)
messages: 264407
nosy: Nathan Williams
priority: normal
severity: normal
status: open
title: xmlrpclib raises when trying to convert an int to string when unicode is 
available
type: crash
versions: Python 2.7

___
Python tracker 

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



[issue20447] doctest.debug_script: insecure use of /tmp

2016-04-27 Thread Berker Peksag

Berker Peksag added the comment:

3.1 is now EOL: 
https://docs.python.org/devguide/index.html#status-of-python-branches

--
nosy: +berker.peksag
resolution:  -> out of date
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



[issue20453] json.load() error message changed in 3.4

2016-04-27 Thread Berker Peksag

Berker Peksag added the comment:

3.4 is in security-fix-only mode and 3.5+ has better error messages thanks to 
JSONDecodeError (07af9847dbec). Closing this as 'out of date'.

--
nosy: +berker.peksag
resolution:  -> out of date
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



[issue25461] Unclear language (the word ineffective) in the documentation for os.walk

2016-04-27 Thread Luiz Poleto

Luiz Poleto added the comment:

The change to os.rst is already committed so I modified the patch to remove it 
and keep only the change to os.py, which looks good and ready to be committed.

--
Added file: http://bugs.python.org/file42635/issue25461.patch

___
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-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Could you provide a response of your server (pass verbose=True to ServerProxy)?

--
nosy: +serhiy.storchaka

___
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-27 Thread Richard PALO

Richard PALO added the comment:

An example:

richard@omnis:/home/richard$ python2.7
Python 2.7.11 (default, Apr 27 2016, 04:35:25) 
[GCC 4.9.3] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes import *
>>> from ctypes.util import find_library
>>> find_library('magic')
>>> cdll.LoadLibrary('libmagic.so')


Finally, as you can see above, LoadLibrary() works fine to load 
'/opt/local/libmagic.so' because of the runpath in the python binary, but 
find_library() does not because the runpath is ignored.

This should probably be considered as 'unexpected' behaviour.

--

___
Python tracker 

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



[issue1145257] shutil.copystat() may fail...

2016-04-27 Thread Berker Peksag

Changes by Berker Peksag :


--
resolution: accepted -> out of date
stage: test needed -> 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



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

2016-04-27 Thread Richard PALO

Richard PALO added the comment:

[fingers not yet warmed up] that is '/opt/local/lib/libmagic.so'

--

___
Python tracker 

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



[issue26867] test_ssl test_options fails on ubuntu 16.04

2016-04-27 Thread Xiang Zhang

Xiang Zhang added the comment:

After some test, I think the reason causing this error is due to 
SSL_CTX_clear_options. 

With OPENSSL_VERSION_NUMBER 268443775, SSL_CTX_clear_options(self->ctx, 
2248147967) returns 33554432, where SSL_CTX_get_options returns 2248147967. 
From the manpage of SSL_CTX_clear_options, it seems it should return 0.

--

___
Python tracker 

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



[issue18551] child_exec() doesn't check return value of fcntl()

2016-04-27 Thread Berker Peksag

Berker Peksag added the comment:

There is one fcntl call in Modules/_posixsubprocess.c now and its return value 
is checked

local_max_fd = fcntl(0, F_MAXFD);
if (local_max_fd >= 0)

Closing this as 'out of date'.

--
nosy: +berker.peksag
resolution:  -> out of date
stage: needs patch -> 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-27 Thread Nathan Williams

Nathan Williams added the comment:

I have attached the response.
As it is coming from our UMS, I had to redact a few values, but that shouldn't 
matter.

For reference, they were the host name of my email address, and the hashes of 
passwords etc.
Our UMS is a bit too chatty!

--
Added file: http://bugs.python.org/file42636/pybug.txt

___
Python tracker 

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



[issue26867] test_ssl test_options fails on ubuntu 16.04

2016-04-27 Thread Xiang Zhang

Xiang Zhang added the comment:

>From the source code (get from apt-get source) of openssl-1.0.2g, I find

SSL_CTX_clear_options(ctx, op):
  op &= ~SSL_OP_NO_SSLv3
  return (ctx->options &= ~op)
SSL_CTX_set_options(ctx, op):
  op |= SSL_OP_NO_SSLv3
  return (ctx->options |= op)

which differs from the official code repos:

SSL_CTX_clear_options(ctx, op):
  return (ctx->options &= ~op)
SSL_CTX_set_options(ctx, op):
  return (ctx->options |= op)

This difference is introduced by debian-specific patch:

 case SSL_CTRL_OPTIONS:
+larg|=SSL_OP_NO_SSLv3;
 return (ctx->options |= larg);
 case SSL_CTRL_CLEAR_OPTIONS:
+larg&=~SSL_OP_NO_SSLv3;
 return (ctx->options &= ~larg);

--

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



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

2016-04-27 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