[issue25544] cleanup temporary files in distutils.has_function

2016-04-04 Thread Min RK

Min RK added the comment:

Absolutely, I'll try to do that tomorrow.

--

___
Python tracker 

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



[issue6953] readline documentation needs work

2016-04-04 Thread Berker Peksag

Berker Peksag added the comment:

readline-doc.v3.patch looks good to me.

--
stage: patch review -> commit review

___
Python tracker 

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



[issue26693] Exception exceptions.AttributeError '_shutdown' in

2016-04-04 Thread Martin Panter

Martin Panter added the comment:

I am seeing an AssertionError, but no AttributeError. In your original post you 
did mention AssertionError, but that contradicts the report title. Please 
clarify what the problem is.

$ CFLAG="$(python3.5m-config --includes)"
$ LDFLAG="$(python3.5m-config --ldflags)"
$ g++ ${CFLAG} ${LDFLAG} test2.C
$ ./a.out
['/home/proj/python/lib', '/usr/lib/python35.zip', '/usr/lib/python3.5', 
'/usr/lib/python3.5/plat-linux', '/usr/lib/python3.5/lib-dynload', 
'/home/.local/lib/python3.5/site-packages', '/usr/lib/python3.5/site-packages']
Exception ignored in: 
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 1292, in _shutdown
assert tlock.locked()
AssertionError:

--
nosy: +martin.panter
status: pending -> open

___
Python tracker 

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



[issue26693] Exception exceptions.AttributeError '_shutdown' in

2016-04-04 Thread Zachary Ware

Zachary Ware added the comment:

After your `import threading` line, try `print(threading.__file__)`.  The path 
should be something like `/usr/local/lib/python3.4/threading.py`; if it's not 
(particularly if the current directory is part of the path), you've found the 
source of your problem, and you should move/rename the extra threading.py, as 
suggested by Brandon in msg144004.

--
nosy: +zach.ware
resolution:  -> duplicate
status: open -> pending
superseder:  -> Exception exceptions.AttributeError '_shutdown' in 

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



[issue25928] Add Decimal.as_integer_ratio()

2016-04-04 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I don't think a new public method should have been added.

Historically, we've been careful to not grow the API beyond what is in the spec 
or the dunder methods required to interface with standard Python.

The feature creep is at odds with the intended goals for the module that have 
been present since the outset.  As long as the spec remains unchanged, the API 
for this module should be treated as stable.

Another issue is that the API for the module is already so large that it 
impairs usability.  Please don't make it worse by adding new methods and 
inventing details that aren't in the spec.

--
nosy: +tim.peters

___
Python tracker 

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



[issue26609] Wrong request target in test_httpservers.py

2016-04-04 Thread Xiang Zhang

Xiang Zhang added the comment:

Get the slash prefixed path in Setup() is a good idea. I change the patch. I 
retain self.tempdir_name so we can use it in a test for no leading slash. The 
case creating index.html is OK with self.tempdir_name since we have changed our 
working directory to basetempdir.

I didn't think about compatibility but I know it's important. So rejecting the 
invalid request-targets is not a good idea to me now.

--
Added file: 
http://bugs.python.org/file42369/request_target_in_test_httpservers_v2.patch

___
Python tracker 

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



[issue26693] Exception exceptions.AttributeError '_shutdown' in

2016-04-04 Thread skydoom

skydoom added the comment:

This is how I compile my code:
CFLAG is obtained from `python3.5m-config --includes`
LDFLAG is obtained from `"python-3.5m-config --ldflags`
g++ ${CFLAG} ${LDFLAG} test2.C 

I am running on Linux.

--

___
Python tracker 

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



[issue26693] Exception exceptions.AttributeError '_shutdown' in

2016-04-04 Thread skydoom

New submission from skydoom:

I did a search and find the issue 1947, however it's set to "not a bug". In its 
last note, it's suggested a 'packaging/environment issue'. But since I can 
reliably reproduce the issue with the "official python package"(that installed 
by the system, such as I am not building the python from source), Also, the 
same issue does not occurred on python 2.6.2, but 3.4.3 and 3.5.1. Even though 
it seems the "AssertionError" message is non-harmful but it's still a bit 
annoying. I am wondering if you can take a look my issue?

Please compile the attached source codes to reproduce my issue. Note that it 
only occurred when we (explicitly or implicitly) import the 'threading' module. 
If we comment out that line, it works fine.

--
components: Library (Lib)
files: test2.C
messages: 262884
nosy: skydoom
priority: normal
severity: normal
status: open
title: Exception exceptions.AttributeError '_shutdown' in 
type: behavior
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file42368/test2.C

___
Python tracker 

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



[issue3213] "pydoc -p" should listen to [::] if IPv6 is supported

2016-04-04 Thread Martin Panter

Martin Panter added the comment:

I understand Windows XP isn’t so important these days. So maybe we just need to 
disable IPV6_V6ONLY. (Unless we want this for 2.7 maybe?)

--
stage:  -> needs patch
versions: +Python 3.6 -Python 3.3

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2016-04-04 Thread Raymond Hettinger

Raymond Hettinger added the comment:

* For most users, this will just be noise (even the existing float method is 
rarely used).   It is unimportant enough that Python existed without it for a 
very long time and it is unimportant enough that it didn't arise during the 
lengthy process of creating the decimal module.  

* The numeric tower doesn't require that we take new methods and push them to 
every type whether or not it makes sense.  Most of the ABCs have only a subset 
of the methods in the concrete types.

* There are already simple workarounds using a try/except or a conditional 
expression.

-1 I really don't want more clutter added to all the numeric classes.  (Clutter 
being something rarely needed, easily implemented in other ways, something that 
looks weird or confusing in classes like int or Fraction, something that we 
have done without to 26 years, something not covered by the decimal spec, and 
something that isn't part of the floats API for either Java* or Smalltalk)

* http://www.tutorialspoint.com/java/lang/java_lang_float.htm

--

___
Python tracker 

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



[issue26692] cgroups support in multiprocessing

2016-04-04 Thread Satrajit Ghosh

New submission from Satrajit Ghosh:

multiprocessing cpucount returns the number of cpus on the system as returned 
by /proc/cpuinfo. 

this is true even on machines where linux kernel cgroups is being used to 
restrict cpu usage for a given process. this results in significant thread 
swithcing on systems with many cores. 

some ideas have been implemented in the following repos to handle cgroups:

https://github.com/peo3/cgroup-utils
http://cpachecker.googlecode.com/svn-history/r12889/trunk/scripts/benchmark/runexecutor.py

it would be nice if multiprocessing was a little more intelligent and queried 
process characteristics.

--
components: Library (Lib)
messages: 262881
nosy: Satrajit Ghosh
priority: normal
severity: normal
status: open
title: cgroups support in multiprocessing
type: behavior

___
Python tracker 

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



[issue25609] Add a ContextManager ABC and type

2016-04-04 Thread Brett Cannon

Brett Cannon added the comment:

Tracker issue created and assigned.

--

___
Python tracker 

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



[issue26691] Update the typing module to match what's in github.com/python/typing

2016-04-04 Thread Brett Cannon

New submission from Brett Cannon:

The code in Lib/typing.py is outdated compared to what's at 
github.com/python/typing.

--
assignee: gvanrossum
messages: 262879
nosy: brett.cannon, gvanrossum
priority: normal
severity: normal
status: open
title: Update the typing module to match what's in github.com/python/typing

___
Python tracker 

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



[issue25609] Add a ContextManager ABC and type

2016-04-04 Thread Brett Cannon

Changes by Brett Cannon :


--
dependencies: +Update the typing module to match what's in 
github.com/python/typing

___
Python tracker 

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



[issue26632] __all__ decorator

2016-04-04 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

Here's my implementation based on eryksun's idea:

def public(thing=None, **kws):
mdict = (sys._getframe(1).f_globals
 if thing is None
 else sys.modules[thing.__module__].__dict__)
dunder_all = mdict.setdefault('__all__', [])
if thing is not None:
dunder_all.append(thing.__name__)
for key, value in kws.items():
dunder_all.append(key)
mdict[key] = value
return thing

--

___
Python tracker 

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



[issue3213] "pydoc -p" should listen to [::] if IPv6 is supported

2016-04-04 Thread Josh Lee

Changes by Josh Lee :


--
nosy: +jleedev

___
Python tracker 

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



[issue24209] Allow IPv6 bind in http.server

2016-04-04 Thread Josh Lee

Changes by Josh Lee :


--
nosy: +jleedev

___
Python tracker 

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



[issue25609] Add a ContextManager ABC and type

2016-04-04 Thread Guido van Rossum

Guido van Rossum added the comment:

No, but feel free to create one and assign it to me -- I will take
care of the rest then.

--

___
Python tracker 

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



[issue25609] Add a ContextManager ABC and type

2016-04-04 Thread Brett Cannon

Brett Cannon added the comment:

Is there a tracking issue I can set as a dependency?

--

___
Python tracker 

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



[issue24505] shutil.which wrong result on Windows

2016-04-04 Thread Bob Alexander

Bob Alexander added the comment:

Oops, clarification...

I just reread my kind of long previous post, and realized it wasn't very 
explicit that anything concerning file extensions or prepending the current 
directory to the PATH apply to Windows only; not Unix (of course).

The "returning absolute, normalized paths" suggestions are multi-platform

I only tested the modified code on Windows.

--

___
Python tracker 

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



[issue25609] Add a ContextManager ABC and type

2016-04-04 Thread Guido van Rossum

Guido van Rossum added the comment:

I have some significant changes to typing.py (and test_typing.py)
upstream in https://github.com/python/typing/. We should coordinate
our changes to stdlib (test_)typing.py.

--

___
Python tracker 

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



[issue25609] Add a ContextManager ABC and type

2016-04-04 Thread Brett Cannon

Brett Cannon added the comment:

When I have a chance I'll do up a new patch where the definition of 
typing.ContextManager is guarded, add a What's New entry, and commit it. My 
planned guard will be:

if hasattr(contextlib, 'AbstractContextManager'):
class ContextManager(...): ...
__all__.append('ContextManager')

--

___
Python tracker 

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



[issue25609] Add a ContextManager ABC and type

2016-04-04 Thread Guido van Rossum

Guido van Rossum added the comment:

(Everything else looks great BTW.)

--

___
Python tracker 

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



[issue25942] subprocess.call SIGKILLs too liberally

2016-04-04 Thread Martin Panter

Martin Panter added the comment:

Even if we can’t agree on any behaviour change, I think it might be worth 
documenting how these functions behave on exceptions (interrupts) other than 
TimeoutExpired. Currently all I can find is “If the timeout expires, the child 
process will be killed and waited for.” I think this could be expanded to also 
say what happens if the parent is interrupted by a signal such as 
KeyboardInterrupt:

* Current behaviour: Immediately kill child (i.e. timeout expiry is not special)

* Previous behaviour: Return without waiting for child, which will become a 
zombie

* Mike’s proposal: Wait indefinitely for child without killing it, which could 
defeat the purpose of the timeout, especially if the child ignores or does not 
receive the same signal as the parent

--

___
Python tracker 

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



[issue25609] Add a ContextManager ABC and type

2016-04-04 Thread Guido van Rossum

Guido van Rossum added the comment:

A slight problem is that I'd really like to keep the source of typing.py 
identical in Python 3.5 and 3.6. So maybe the definition should be conditional 
on the presence of AbstractContextManager?

--

___
Python tracker 

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



[issue21048] Index 'as' in import and with statements

2016-04-04 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Second try.

--

___
Python tracker 

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



[issue12494] subprocess: check_output() doesn't close pipes on error

2016-04-04 Thread Martin Panter

Martin Panter added the comment:

As I understand it, this change only made it to 3.3+

--
nosy: +martin.panter
versions:  -Python 2.7, Python 3.2

___
Python tracker 

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



[issue21048] Index 'as' in import and with statements

2016-04-04 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Test email to see if I can get tracker email at different address, now the 
google is dumping some tracker email.  Issue selected as it is closed and I am 
only nosy listed.

--

___
Python tracker 

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



[issue19944] Make importlib.find_spec load packages as needed

2016-04-04 Thread Eric Snow

Eric Snow added the comment:

Yeah, I'm pretty sure that TODO is out of date.

--

___
Python tracker 

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



[issue26690] PyUnicode_Decode breaks when Python / sqlite3 is built with sqlite 3.12.0

2016-04-04 Thread mike bayer

mike bayer added the comment:

i realized this is probably with my build overall.  let me do some more testing 
and ill reopen if i can confirm this more closely.

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

___
Python tracker 

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



[issue26690] PyUnicode_Decode breaks when Python / sqlite3 is built with sqlite 3.12.0

2016-04-04 Thread mike bayer

New submission from mike bayer:

So I really don't know *where* the issue is in this one, because I don't know 
enough about the different bits.

Step 1:  Save this C program to demo.c:

#include 

static PyObject *
unicode_thing(PyObject *self, PyObject *value)
{
char *str;
Py_ssize_t len;

if (value == Py_None)
Py_RETURN_NONE;

if (PyString_AsStringAndSize(value, , ))
return NULL;

   return PyUnicode_Decode(str, len, "utf-8", "ignore");
}


static PyMethodDef UnicodeMethods[] = {
{"unicode_thing",  unicode_thing, METH_O,
 "do a unicode thing."},
{NULL, NULL, 0, NULL}/* Sentinel */
};



PyMODINIT_FUNC
initdemo(void)
{
(void) Py_InitModule("demo", UnicodeMethods);
}


Step 2:  Build with a setup.py:

from distutils.core import setup, Extension

module1 = Extension('demo',
sources = ['demo.c'])

setup (name = 'PackageName',
   version = '1.0',
   description = 'This is a demo package',
   ext_modules = [module1])


$ python setup.py build_ext

3. Run with a normal Python that is *not* built against SQLite 3.12.0:

$ python
Python 2.7.10 (default, Sep  8 2015, 17:20:17) 
[GCC 5.1.1 20150618 (Red Hat 5.1.1-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import demo
>>> demo.unicode_thing('sql')
u'sql'

4. Now build Python 2.7.11 *with* SQLite 3.12.0 in the -I / -L paths.  Run the 
same program *With* that Python:

$ /opt/Python-2.7.11-sqlite-3.12.0/bin/python
Python 2.7.11 (default, Apr  4 2016, 14:20:47) 
[GCC 5.3.1 20151207 (Red Hat 5.3.1-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import demo
>>> demo.unicode_thing('sql')
u's\x00q'

Somehow the presence of sqlite-3.12.0 in the build is breaking the Python 
interpreter.   I think.  I really don't know.   The bad news is, this is the 
code for SQLAlchemy's unicode processor, and as SQlite 3.12.0 starts getting 
put in distros, the world is going to break.  So this is kind of really hard to 
test, I don't understand it, and it's totally urgent.  Any insights would be 
appreciated!

--
components: Extension Modules
messages: 262864
nosy: zzzeek
priority: normal
severity: normal
status: open
title: PyUnicode_Decode breaks when Python / sqlite3 is built with sqlite 3.12.0
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



[issue26689] Add `has_flag` method to `distutils.CCompiler`

2016-04-04 Thread Sylvain Corlay

Sylvain Corlay added the comment:

A new version of the patch using `NamedTemporaryFile` instead a the regular 
fdopen.

--
Added file: http://bugs.python.org/file42367/has_flag.diff

___
Python tracker 

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



[issue19944] Make importlib.find_spec load packages as needed

2016-04-04 Thread Terry J. Reedy

Terry J. Reedy added the comment:

pyclbr.py has this comment
   # XXX This will change once issue19944 lands.
above the line that was changed by the patch applied.  Am I correct in thinking 
that the comment is obsolete and should be removed?

--
nosy: +terry.reedy

___
Python tracker 

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



[issue26391] typing: Specialized sub-classes of Generic never call __init__

2016-04-04 Thread Guido van Rossum

Guido van Rossum added the comment:

This is fixed upstream 
(https://github.com/python/typing/commit/8c6aaf30751fec28f1a7e467139ae23c9cc30c81).
 I'm keeping this open until I've merged typing.py into CPython 3.5 and 3.6.

--

___
Python tracker 

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



[issue25987] collections.abc.Reversible

2016-04-04 Thread Guido van Rossum

Guido van Rossum added the comment:

Done. Thanks!

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

___
Python tracker 

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



[issue25987] collections.abc.Reversible

2016-04-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 07f73360ea8e by Guido van Rossum in branch 'default':
Add collections.Reversible. Patch by Ivan Levkivskyi. Fixes issue #25987.
https://hg.python.org/cpython/rev/07f73360ea8e

--
nosy: +python-dev

___
Python tracker 

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



[issue25987] collections.abc.Reversible

2016-04-04 Thread Guido van Rossum

Guido van Rossum added the comment:

Looks good. I'll merge this in a sec.

--

___
Python tracker 

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



[issue26623] JSON encode: more informative error

2016-04-04 Thread Mahmoud Lababidi

Mahmoud Lababidi added the comment:

Serhiy,

I've attached a patch without the Object representation. Choose whichever you 
feel is better.

--
Added file: http://bugs.python.org/file42366/json_encode.patch

___
Python tracker 

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



[issue25544] cleanup temporary files in distutils.has_function

2016-04-04 Thread SilentGhost

SilentGhost added the comment:

Hi Min RK, could you please update your patch so that it would cleanly apply to 
the tip of default branch. Also since you're re-writing a big chunk of that 
function, could I ask you to use with context manager for the temporary source 
file.

--
nosy: +SilentGhost
stage:  -> needs patch
versions:  -Python 3.4

___
Python tracker 

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



[issue26689] Add `has_flag` method to `distutils.CCompiler`

2016-04-04 Thread SilentGhost

SilentGhost added the comment:

I guess it would make sense to depend on issue25544 and implement the has_flag 
with minrk's patch in mind. I guess his patch didn't get a second look because 
it didn't apply cleanly.

In any case, for implementing has_flag using current best practice is what I'd 
recommend.

--
dependencies: +cleanup temporary files in distutils.has_function

___
Python tracker 

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



[issue24505] shutil.which wrong result on Windows

2016-04-04 Thread Bob Alexander

Bob Alexander added the comment:

Since there seems to be ongoing work on the "which"
function, here are a few more thoughts on this function's
future:

  - The existing version does not prepend the current
directory to the path if it is already in the path.
If the current directory is in the path but is not
the first element, it will not be the first directory
searched. It seems that the desired behavior is to
search the current directory first, so the current
directory should *always* be prepended. The existing
"which" function already has an optimization to only
search each directory once, so it's not a problem if
the current directory is unconditionally prepended
and may end up in there twice. This change would
actually be a "correction", since the doc says the
current directory is prepended

  - The function should always return an absolute path,
which is the behavior of the Unix(1) "which" command
and, I think, is the typical expected behavior of a
"which"-type request. The existing implementation
returns a relative path in certain cases, such as if
the file is found via a relative directory reference
in the path. This change is not inconsistent with
the doc, since the doc does not address it.

  - It would be nice if the extension added when the
given command has no extension were lower case,
instead of the upper case extension retrieved from
the PATHEXT environment variable. Several other
"which" implementations work that way (e.g.
see Go's os/exec.LookPath function), producing
a more aesthetically pleasing name, as well as
being more consistent with naming practices of the
last 20+ years. The shocking-looking upper case
sxtensions remind me of VERY OLD DOS programs  :-)
This presents no conflict with the doc, and does
not affect "correctness" since Windows file names
are case-independent.

A previous commenter objected to adding lower case
extensions, but consider:
  - The current version never returns the extension
case of the actual file. It returns the extension
of the command string passed to the function,
if any, otherwise it adds the extension from the
PATHEXT environment variable, either of which
might not match the actual file.
  - Returning the actual extension of the found file
might be nice, but would require additional I/O;
added expense for little return. This is not
done in the current version.
  - The PATHEXT variable that ships with Windows
contains the allowable extensions in upper case,
an old DOS artifact. Few executable files these
days have uppercase extensions. Using a lower
case extension when the function has to invent
one is a "modernization".

  - It would be nice if the returned file path were
normalized. Currently, sometimes an unnormalized
path is returned with a leading ".\".

I did write an update to "which" with the above changes,
and also updated the unit tests with:
  - 2 new tests to catch the bug that is the subject of
this issue.
  - some tests were updated for the small changes such
as normalization and lower case added extensions.
A zip file is attached with my updates. I'm not an
official "contributor", but feel free incorporate the
contents in any way you deem appropriate. The files are:

shutil.py
updated shutil module
shutil.py_3_5_1
existing 3.5.1 shutil module -- basis for updates
test_shutil_for_current_w_added_tests.py
unit tests for existing 3.5.1 version of shutil with
new tests to catch this bug
test_shutil_for_new_version.py
unit tests for attached updated version of shutil
test_shutil_3_5_1.py
existing 3.5.1 unit tests -- basis for updates

Bob

--
Added file: http://bugs.python.org/file42365/new_which_bug_files.zip

___
Python tracker 

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



[issue26689] Add `has_flag` method to `distutils.CCompiler`

2016-04-04 Thread Sylvain Corlay

Sylvain Corlay added the comment:

@minrk submitted 
http://bugs.python.org/file40933/0001-cleanup-temporary-files-in-ccompiler.has_function.patch
doing what you describe for `has_function`. 

I don't know much about the process to contribute to cpython. I would be glad 
to open a "PR" incorporating Min's commits too.

--

___
Python tracker 

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



[issue25942] subprocess.call SIGKILLs too liberally

2016-04-04 Thread Robert Cope

Changes by Robert Cope :


--
nosy: +rpcope1

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2016-04-04 Thread Stefan Krah

Stefan Krah added the comment:

I agree that Robert's "absurdity" argument was unfortunate and could
be reversed: Many people would consider an (10).is_integer() method
absurd.

I'm also only moderately interested in OOP or classification in general, but  
we *do* have a numeric tower modeled after Scheme,
so here goes:

scheme@(guile-user)> (integer? 487)
$1 = #t
scheme@(guile-user)> (integer? 1.2)
$2 = #f
scheme@(guile-user)> (integer? 1.0)
$3 = #t
scheme@(guile-user)> (integer? 1/7)
$4 = #f
scheme@(guile-user)> (integer? 100/10)
$5 = #t
scheme@(guile-user)> 


The ACL2 theorem prover has the same:

ACL2 !>(integerp 100)
T
ACL2 !>(integerp 100/10)
T
ACL2 !>(integerp 100/7)
NIL


For me, these functions are something fundamental. I'd prefer
them to be exposed in a functional manner like above, but we
do have the numeric tower.

--

___
Python tracker 

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



[issue26689] Add `has_flag` method to `distutils.CCompiler`

2016-04-04 Thread SilentGhost

SilentGhost added the comment:

I understand that you're copying approach of has_function, but shouldn't you 
remove this temporary file at the end of the function? Perhaps using 
tempfile.NamedTemporaryFile would be a better solution (both in has_flag and 
has_function). Also import can be moved to the top level, since it's used in 
more than one method.

--

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2016-04-04 Thread Robert Smallshire

Robert Smallshire added the comment:

To be clear, I'm not arguing that is_integer is in the same category as hex and 
fromhex; is_integer is a mathematical property of the number, whereas hex and 
from hex are representational. Nobody expects interoperability of string 
representations of the different number types.

Neither do I take issue with the general argument against enlarging the API. In 
fact, if float.is_integer did not exist, I would not be campaigning for it to 
be invented.

What I do take issue with is already having a method on float which makes sense 
for all Real numbers, but then not supporting it for those other Real types. 
This just gets in the way of programming generally in terms of *numbers* rather 
than concrete types, especially when the is_integer method is being advocated 
as the *right way* to do such a test. This is can lead to other problems as 
people unthinkingly convert other number types to floats, with loss of 
information, just to get access to this convenience method. 

I'm (really) surprised that structural typing and polymorphism over numbers 
carries so little weight – a cursory look at StackOverflow* shows that there 
are already too many people being encouraged to answer the 'is integral' 
question with isinstance(x, int) when that is not what they mean or need.

As a precedent we already have int.numerator, int.denominator, int.real and 
int.imag which are presumably using Raymond's argument are also 'total waste', 
but the reality is that the presence of these attributes causes no impediment 
to learning and makes many tasks easier with fewer special cases. When working 
with rationals, I frequently rely on the fact that ints implement the Rational 
interface.  When working with complex numbers, I frequently rely on the fact 
that both int and float implement the Complex interface. For example. I have 
used use these attributes in the constructor for a fixed-point number type, and 
was thankful for their existence.

I'm also happy to set the Decimal aspect of my proposal to one side as Decimal 
is explicitly outside the numeric tower.

This isn't about me avoiding writing trivial one-line functions or "the OPs use 
case". I'm trying to help you make Python more predictable and easier to use.  
I'm far from the first person to be surprised by this.

I'd be happy to trade adding is_integer to the numeric tower for a deprecation 
notice on float.is_integer - the outcome is the same - polymorphic number types 
with fewer special cases.







--

___
Python tracker 

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



[issue26257] Eliminate buffer_tests.py

2016-04-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

And would be nice to backport these changes to 2.7. This will help backporting 
new future tests.

--
assignee:  -> martin.panter
stage: patch review -> commit review

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2016-04-04 Thread Raymond Hettinger

Raymond Hettinger added the comment:

FWIW, I think the reasoning in http://bugs.python.org/issue1093 applies here as 
well.  The need is insufficient to warrant inclusion in the numeric tower and 
propagation to types like int and Fraction.

--

___
Python tracker 

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



[issue26257] Eliminate buffer_tests.py

2016-04-04 Thread Martin Panter

Martin Panter added the comment:

Okay you convinced me to leave those methods in the same relative position as 
in your patch. I can sympathize with keeping the Mercurial history small. :)

The only disadvantage is a couple extra microseconds wasted doing redundant 
tests. I will try and work on factoring out some of those tests next.

--

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2016-04-04 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> the functions are so simple and self-explanatory 
> that API-complexity does not really increase.

It increases complexity because it will show-up everywhere including places 
where it makes little sense.

One place is int objects where its meaning and purpose will seem arcane to most 
Python programmers.  For int objects, this is just total waste.

With the fractions module, the method is also unnecessary because integral 
fractions all have a denominator of 1.

With the decimal module, we were careful not to grow the API beyond what was in 
the spec or what was necessary to integrate it into Python (i.e. the usual 
magic methods).  I think that was a good decision and would like to keep it 
that way. 

In general, the need for this method is almost nil (it would be a very, very 
rare Python programmer who would ever need this, and those that might what it 
are perfectly capable of writing a short function to handle their own 
requirements).  In the OPs case, the motivation isn't inability to determine 
whether something is integral, it is more a desire for the test to be 
polymorphic with other types where the methods do not add any real value.  

The OPs notion of "absurd" behavior implies a rule that all float methods 
should be available for ints.  That would suggest the is_integer, hex, fromhex, 
and as_integer_ratio would all need to propagate to the other types as well.  I 
don't think we should start sliding down that slope.

Another thought is that future updates to the decimal spec could make 
conflicting choices about what Decimal.is_integral() would return for 
Decimal('Infinity').  There could be a case to be made for true, for false, for 
NaN, or for setting one or more of the signal flags or traps.  

I'm glad that the OP separated out the request for Decimal given that his 
actual use cases involve everything except Decimal.  The decimal class is 
intentionally not registered a Real (only as a Number) because it isn't 
interoperable with binary floats; hence, there has been no need to copy all the 
float methods into Decimal.

AFAICT, this comes down to whether to push a float method into other types 
where we otherwise wouldn't do it, just to save the OP from one-line function:

is_integral = lambda x:  isinstance(x, int) or isinstance(x, Fraction) and 
x.denominator == 1 or isinstance(x, float) and x.is_integer()

--
nosy: +tim.peters

___
Python tracker 

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



[issue26257] Eliminate buffer_tests.py

2016-04-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Unfortunately Mercurial can't handle moving file fragments. The history of 
these methods will be lost. That is why I prefer the patch with minimal moving.

Are there any disadvantages of having test_additional_(r)split() and 
test_strip() in BaseTest?

--

___
Python tracker 

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



[issue23863] Fix EINTR Socket Module issues in 2.7

2016-04-04 Thread Robert Cope

Changes by Robert Cope :


--
nosy: +rpcope1

___
Python tracker 

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



[issue13285] signal module ignores external signal changes

2016-04-04 Thread Robert Cope

Changes by Robert Cope :


--
nosy: +rpcope1

___
Python tracker 

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



[issue26257] Eliminate buffer_tests.py

2016-04-04 Thread Martin Panter

Martin Panter added the comment:

I see what you meant about making the diff smaller. However in your patch you 
also moved three extra methods into BaseTest: test_additional_(r)split() and 
test_strip().

I prefer to handle these three methods in a separate patch that deals with 
test_bytes.BytesBaseTest, which also has split() and strip() tests. So this 
third patch moves those three methods back to CommonTest.

--
Added file: http://bugs.python.org/file42364/buffer_tests_3.patch

___
Python tracker 

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