[issue25372] load_module() does not link submodule to parent package

2015-10-13 Thread Martin Panter

Martin Panter added the comment:

My use case is for Readline auto-completion, to list submodules of a package 
given by the user, without importing anything unnecessary. The original code is 
compatible with Python 2, but I am also writing a patch for 3.6 that wouldn't 
need that. The original implementation is like this pseudocode:

def list_submodules(package):
# Ensure it is a package before loading or importing it
for name in parent_packages:
loader = pkgutil.find_loader(name)
assert loader.is_package()
# Could call importlib.import_module(), but this seemed easier because I 
already have the loader:
package = loader.load_module(name)
# The only reason I want to load the module:
search_path = package.__path__
return pkgutil.iter_modules(search_path)

Thanks for your feedback Brett. I have changed over to 
importlib.import_module(), and will accept that this is just a quirk of the low 
level import stuff.

--

___
Python tracker 

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



[issue24782] Merge 'configure extensions' into main IDLE config dialog

2015-10-13 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Nice. The only changes I had to make other than a doc change are 'Settings tab' 
to 'Extensions tab' and deletion of an line-ending space that got added in 
editing the extension doc string.  We both need to remember to strip trailing 
whitespace, as it causes changesets to be rejected when pushed. Pl

--
assignee:  -> terry.reedy
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



[issue24782] Merge 'configure extensions' into main IDLE config dialog

2015-10-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 334dc1abc8af by Terry Jan Reedy in branch '2.7':
Issue #24782: Finish converting the Configure Extension dialog into a new
https://hg.python.org/cpython/rev/334dc1abc8af

New changeset 5647c61fb593 by Terry Jan Reedy in branch '3.4':
Issue #24782: Finish converting the Configure Extension dialog into a new
https://hg.python.org/cpython/rev/5647c61fb593

New changeset 6bce28fec911 by Terry Jan Reedy in branch '2.7':
Issue #24782: whitespace
https://hg.python.org/cpython/rev/6bce28fec911

New changeset 4ed0cc2b7c7c by Terry Jan Reedy in branch '3.4':
Issue #24782: whitespace
https://hg.python.org/cpython/rev/4ed0cc2b7c7c

--

___
Python tracker 

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



[issue25400] robotparser doesn't return crawl delay for default entry

2015-10-13 Thread Peter Wirtz

Peter Wirtz added the comment:

This fix breaks the unit tests though. I am not sure how to go about checking 
those as this would be my first contribution to python and an open source 
project in general.

--

___
Python tracker 

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



[issue25400] robotparser doesn't return crawl delay for default entry

2015-10-13 Thread Peter Wirtz

New submission from Peter Wirtz:

After changeset http://hg.python.org/lookup/dbed7cacfb7e, calling the 
crawl_delay method for a robots.txt files that has a crawl-delay for * 
useragents always returns None.

Ex:

Python 3.6.0a0 (default:1aae9b6a6929+, Oct  9 2015, 22:08:05)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib.robotparser
>>> parser = urllib.robotparser.RobotFileParser()
>>> parser.set_url('https://www.carthage.edu/robots.txt')
>>> parser.read()
>>> parser.crawl_delay('test_robotparser')
>>> parser.crawl_delay('*')
>>> print(parser.default_entry.delay)
120
>>>

Excerpt from https://www.carthage.edu/robots.txt:

User-agent: *
Crawl-Delay: 120
Disallow: /cgi-bin

I have written a patch that solves this. With patch, output is:

Python 3.6.0a0 (default:1aae9b6a6929+, Oct  9 2015, 22:08:05)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib.robotparser
>>> parser = urllib.robotparser.RobotFileParser()
>>> parser.set_url('https://www.carthage.edu/robots.txt')
>>> parser.read()
>>> parser.crawl_delay('test_robotparser')
120
>>> parser.crawl_delay('*')
120
>>> print(parser.default_entry.delay)
120
>>>

This also applies to the request_rate method.

--
components: Library (Lib)
files: robotparser_crawl_delay.patch
keywords: patch
messages: 252971
nosy: pwirtz
priority: normal
severity: normal
status: open
title: robotparser doesn't return crawl delay for default entry
type: behavior
versions: Python 3.6
Added file: http://bugs.python.org/file40777/robotparser_crawl_delay.patch

___
Python tracker 

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



[issue25399] Optimize bytearray % args

2015-10-13 Thread STINNER Victor

New submission from STINNER Victor:

Optimize bytearray % args

Don't create temporary bytes objects: modify _PyBytes_Format() to create work
directly on bytearray objects.

* _PyBytesWriter: add use_bytearray attribute to use a bytearray buffer
* Rename _PyBytes_Format() to _PyBytes_FormatEx() just in case if something
  outside CPython uses it
* _PyBytes_FormatEx() now uses (char*, Py_ssize_t) for the input string, so
  bytearray_format() doesn't need tot create a temporary input bytes object
* Add use_bytearray parameter to _PyBytes_FormatEx() which is passed to
  _PyBytesWriter, to create a bytearray buffer instead of a bytes buffer

--
files: bytearray_format.patch
keywords: patch
messages: 252970
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Optimize bytearray % args
type: performance
versions: Python 3.6
Added file: http://bugs.python.org/file40776/bytearray_format.patch

___
Python tracker 

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



[issue25397] improve ac_cv_have_long_long_format GCC fallback

2015-10-13 Thread Mike Frysinger

New submission from Mike Frysinger:

the ac_cv_have_long_long_format test has a nice compile-time fallback for gcc 
based compilers:
CFLAGS="$CFLAGS -Werror -Wformat"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include 
#include 
  ]], [[
  char *buffer;
  sprintf(buffer, "%lld", (long long)123);
  sprintf(buffer, "%lld", (long long)-123);
  sprintf(buffer, "%llu", (unsigned long long)123);
  ]])],
  ac_cv_have_long_long_format=yes
)

unfortunately, this turns on the global -Werror flag in order to check things.  
that means if the code triggers unrelated warnings, the test still fails ;(.  
this comes up w/bionic which complains about unsafe use of the sprintf 
function, and can come up in general in this code because buffer is not 
initialized :).

the good news is that gcc-4.2 has supported a directed -Werror=format option.
https://gcc.gnu.org/onlinedocs/gcc-4.2.4/gcc/Warning-Options.html

so instead of using -Werror -Wformat, you could use -Werror=format.  the 
downside is that the fallback no longer works with <=gcc-4.1, but maybe that's 
ok considering gcc-4.2 was released May 2007 (almost 9 years ago) ?

note: this also applies to various other tests in the configure file.

NB: landing a fix in py3.5+ (and ignoring 3.[0-4]) is fine, but please also to 
fix py2.7 :)

--
components: Cross-Build
messages: 252968
nosy: vapier
priority: normal
severity: normal
status: open
title: improve ac_cv_have_long_long_format GCC fallback
type: enhancement
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue18148] Make of Python 3.2.2 fails on Solaris SPARC

2015-10-13 Thread Mike Frysinger

Mike Frysinger added the comment:

if the current builds fail, please make sure to include the config.log file as 
that includes a cross-compile test for this setting

--
nosy: +vapier

___
Python tracker 

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



[issue19372] configure and compile problems with older CentOS releases

2015-10-13 Thread Mike Frysinger

Mike Frysinger added the comment:

time to close then ?

--
nosy: +vapier

___
Python tracker 

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



[issue25093] New 3.5.0 failure in test_tcl on win7

2015-10-13 Thread Zachary Ware

Zachary Ware added the comment:

Thank you for the patch, Serhiy.  I'm just sorry it took me so long to get it 
committed.

--

___
Python tracker 

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



[issue25396] A Python runtime not could be located.

2015-10-13 Thread Zachary Ware

Zachary Ware added the comment:

Sorry, this is not the appropriate place to look for help with this issue; it's 
not a bug with Python itself.  I'd suggest asking on a Mac help forum.  There 
was a similar question on python-list a few months ago, you might find some 
pointers in that thread: 
https://mail.python.org/pipermail/python-list/2015-May/691527.html

Good luck!

--
nosy: +zach.ware
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue25386] msvcrt_putch/msvcrt_putwch don't check the return value of _putch/_putwch

2015-10-13 Thread eryksun

eryksun added the comment:

> It would be interesting to know under what circumstances these 
> functions can fail.

The CRT _put[w]ch and _get[w]ch[e] functions will fail when called in a process 
that doesn't have a console. (Except get[w]ch may succeed if it follows 
unget[w]ch.) This is the case when running under pythonw.exe if the process 
hasn't first attached to a console via AllocConsole() or AttachConsole(). It 
also applies to python.exe when run as a detached process (i.e. the creation 
flag DETACHED_PROCESS) or after having detached the console via FreeConsole(). 

Note that even though the docs for get[w]ch [1] and get[w]che [2] state that 
"[t]here is no error return", these functions actually do return an error value 
of [W]EOF. This has been the case since at least back to Windows NT. Maybe 
Steve Dower can shed light on why this is undocumented.

Here's an example, tested on 64-bit Windows 10 in Python 3.5. This example 
calls the console I/O functions using both msvcrt and ctypes. Since there's no 
attached console, an error is expected, except when calling ungetwch followed 
by getwch.

import os
import sys
import subprocess

cmds_msvcrt = [
"import msvcrt; msvcrt.ungetwch('a'); msvcrt.getwch()",
"import msvcrt; msvcrt.ungetwch('a'); msvcrt.ungetwch('a')",
"import msvcrt; msvcrt.getwch()",
"import msvcrt; msvcrt.putwch('a')",
]

csetup = "import sys,ctypes; ucrt = ctypes.cdll.ucrtbase; "

cmds_ctypes = [
csetup + "ucrt._ungetwch(ord('a')); sys.exit(ucrt._getwch())",
csetup + "ucrt._ungetwch(ord('a')); sys.exit(ucrt._ungetwch(ord('a')))",
csetup + "sys.exit(ucrt._getwch())",
csetup + "sys.exit(ucrt._putwch(ord('a')))",
]

def test(cmds):
pythonw = os.path.join(sys.prefix, 'pythonw.exe')
return [subprocess.call([pythonw, '-c', cmd]) for cmd in cmds]


>>> test(cmds_msvcrt)
[0, 1, 0, 0]

>>> test(cmds_ctypes)
[97, 65535, 65535, 65535]

65535 is WEOF. 

[1]: https://msdn.microsoft.com/en-us/library/078sfkak
[2]: https://msdn.microsoft.com/en-us/library/kswce429

--
nosy: +eryksun

___
Python tracker 

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



[issue17908] Unittest runner needs an option to call gc.collect() after each test

2015-10-13 Thread STINNER Victor

STINNER Victor added the comment:

Well, maybe we can add yet another parameter to all unittest classes
(push this change), but IMHO someone must rework the unittest API to
make it more extensible instead of adding more and more stuff in the
base API.

--

___
Python tracker 

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



[issue25395] SIGSEGV using json.tool

2015-10-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

3.6.0a0 (de982d8b7b15)

#0  0x080e62a1 in _PyTrash_thread_destroy_chain () at Objects/object.c:2010
#1  0x080bf8b3 in frame_dealloc (f=f@entry=0x83f06e4) at 
Objects/frameobject.c:462
#2  0x080e3eef in _Py_Dealloc (op=op@entry=0x83f06e4) at Objects/object.c:1786
#3  0x081909c1 in fast_function (func=func@entry=0xb77f4154, 
pp_stack=pp_stack@entry=0xbfffe6ac, n=n@entry=0, na=na@entry=0, nk=nk@entry=0) 
at Python/ceval.c:4752
#4  0x0819102a in call_function (pp_stack=pp_stack@entry=0xbfffe6ac, 
oparg=oparg@entry=0) at Python/ceval.c:4677
#5  0x0818e1f7 in PyEval_EvalFrameEx (f=f@entry=0xb795f034, 
throwflag=throwflag@entry=0) at Python/ceval.c:3181
#6  0x081906e7 in _PyEval_EvalCodeWithName (_co=_co@entry=0xb77f00f8, 
globals=globals@entry=0xb798f734, locals=locals@entry=0xb798f734, 
args=args@entry=0x0, 
argcount=argcount@entry=0, kws=kws@entry=0x0, kwcount=kwcount@entry=0, 
defs=defs@entry=0x0, defcount=defcount@entry=0, kwdefs=kwdefs@entry=0x0, 
closure=closure@entry=0x0, name=name@entry=0x0, 
qualname=qualname@entry=0x0) at Python/ceval.c:3962
#7  0x0819080a in PyEval_EvalCodeEx (_co=_co@entry=0xb77f00f8, 
globals=globals@entry=0xb798f734, locals=locals@entry=0xb798f734, 
args=args@entry=0x0, 
argcount=argcount@entry=0, kws=kws@entry=0x0, kwcount=kwcount@entry=0, 
defs=defs@entry=0x0, defcount=defcount@entry=0, kwdefs=kwdefs@entry=0x0, 
closure=closure@entry=0x0) at Python/ceval.c:3983
#8  0x0819086d in PyEval_EvalCode (co=co@entry=0xb77f00f8, 
globals=globals@entry=0xb798f734, locals=locals@entry=0xb798f734) at 
Python/ceval.c:777
#9  0x08180503 in builtin_exec_impl (module=module@entry=0xb7a1e534, 
source=0xb77f00f8, globals=0xb798f734, locals=0xb798f734) at 
Python/bltinmodule.c:942
#10 0x08180688 in builtin_exec (module=module@entry=0xb7a1e534, 
args=args@entry=0xb78b784c) at Python/clinic/bltinmodule.c.h:275
#11 0x080e025c in PyCFunction_Call (func=func@entry=0xb7a1ecb4, 
args=args@entry=0xb78b784c, kwds=kwds@entry=0x0) at Objects/methodobject.c:109
#12 0x08190f18 in call_function (pp_stack=pp_stack@entry=0xbfffe97c, 
oparg=oparg@entry=2) at Python/ceval.c:4651
#13 0x0818e1f7 in PyEval_EvalFrameEx (f=f@entry=0xb79d4cac, 
throwflag=throwflag@entry=0) at Python/ceval.c:3181
#14 0x081906e7 in _PyEval_EvalCodeWithName (_co=0xb78b9028, globals=, locals=locals@entry=0x0, args=args@entry=0xb7a00e84, 
argcount=argcount@entry=5, 
kws=kws@entry=0xb7a00e98, kwcount=kwcount@entry=0, 
defs=defs@entry=0xb78ba288, defcount=5, kwdefs=kwdefs@entry=0x0, 
closure=closure@entry=0x0, 
name=name@entry=0xb78b83e8, qualname=qualname@entry=0xb78b83e8) at 
Python/ceval.c:3962
#15 0x08190a52 in fast_function (func=func@entry=0xb7925994, 
pp_stack=pp_stack@entry=0xbfffeb3c, n=n@entry=5, na=na@entry=5, nk=nk@entry=0) 
at Python/ceval.c:4760
#16 0x0819102a in call_function (pp_stack=pp_stack@entry=0xbfffeb3c, 
oparg=oparg@entry=5) at Python/ceval.c:4677
#17 0x0818e1f7 in PyEval_EvalFrameEx (f=f@entry=0xb7a00d1c, 
throwflag=throwflag@entry=0) at Python/ceval.c:3181
#18 0x081906e7 in _PyEval_EvalCodeWithName (_co=_co@entry=0xb78b9298, 
globals=globals@entry=0xb78b17dc, locals=locals@entry=0x0, 
args=args@entry=0xb79b83c8, 
argcount=argcount@entry=2, kws=kws@entry=0x0, kwcount=kwcount@entry=0, 
defs=defs@entry=0xb78b7eb8, defcount=defcount@entry=1, kwdefs=kwdefs@entry=0x0, 
closure=closure@entry=0x0, name=name@entry=0x0, 
qualname=qualname@entry=0x0) at Python/ceval.c:3962
#19 0x0819080a in PyEval_EvalCodeEx (_co=0xb78b9298, 
globals=globals@entry=0xb78b17dc, locals=locals@entry=0x0, 
args=args@entry=0xb79b83c8, argcount=2, 
kws=kws@entry=0x0, kwcount=kwcount@entry=0, defs=defs@entry=0xb78b7eb8, 
defcount=defcount@entry=1, kwdefs=0x0, closure=0x0) at Python/ceval.c:3983
#20 0x0820be82 in function_call (func=0xb7841454, arg=0xb79b83b4, kw=0x0) at 
Objects/funcobject.c:632
#21 0x080939ce in PyObject_Call (func=func@entry=0xb7841454, 
arg=arg@entry=0xb79b83b4, kw=kw@entry=0x0) at Objects/abstract.c:2147
#22 0x0807614a in RunModule (modname=modname@entry=0x8330308 L"json.tool", 
set_argv0=set_argv0@entry=1) at Modules/main.c:208
#23 0x08076f56 in Py_Main (argc=argc@entry=5, argv=argv@entry=0x832f010) at 
Modules/main.c:709
#24 0x0805edb4 in main (argc=5, argv=0xbfffee84) at ./Programs/python.c:69

--

___
Python tracker 

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



[issue25395] SIGSEGV using json.tool

2015-10-13 Thread STINNER Victor

STINNER Victor added the comment:

Can you post a GDB traceback?

--

___
Python tracker 

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



[issue25395] SIGSEGV using json.tool

2015-10-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Doesn't crash on 3.4.3. Crashes on 3.5.0. The crash is reproduced with 
Python-only implementation of json, therefore it is not related to json.

--
nosy: +haypo
priority: normal -> high

___
Python tracker 

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



[issue17908] Unittest runner needs an option to call gc.collect() after each test

2015-10-13 Thread STINNER Victor

STINNER Victor added the comment:

While I like the idea of adding an option to force a garbage collection after 
running each time, I don't like how unittest is growing :-( It looks more and 
more like regrtest and I hate regrtest (I reworked its code recently to create 
a less ugly "libregrtes").

Once Antoine Pitrou proposed to add "plugins" to unittest. I agree that we need 
a gate between unittest and all other test frameworks: nose, py.test, 
testtools/testrepository/testr, etc.

Seriously, don't you think that something is wrong with such API?

def __init__(self, module='__main__', defaultTest=None, argv=None,
 testRunner=None, testLoader=loader.defaultTestLoader,
 exit=True, verbosity=1, failfast=None, catchbreak=None,
 buffer=None, warnings=None, *, tb_locals=False,
 gc_enabled=False):

--

___
Python tracker 

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



[issue17908] Unittest runner needs an option to call gc.collect() after each test

2015-10-13 Thread Adam

Adam added the comment:

Any comments about this proposed patch?

--

___
Python tracker 

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



[issue25395] SIGSEGV using json.tool

2015-10-13 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +serhiy.storchaka
stage:  -> needs patch
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



[issue25370] Add support of pickling very large bytes and str objects with protocol < 4

2015-10-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is preliminary patch. It doesn't include changes to tests. Some bigmem 
tests need to be changed.

--
keywords: +patch
stage:  -> patch review
Added file: http://bugs.python.org/file40774/pickle_large_strings.patch

___
Python tracker 

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



[issue25396] A Python runtime not could be located.

2015-10-13 Thread Brian

New submission from Brian:

Hello - I'm new to this community and an system error brings me here.  Thank 
you all in advance for any help and support!

I'm using a MacBook Pro (Retina, 15-inch, Late 2013) with OS 10.11 El Capitan.  
I receive the following error every 15-30 minutes:


"Utility[601]: A Python runtime not could be located.  You may need to install 
a framework build of Python, or edit the PyRuntimeLocations array in this 
application's Info.plist file."

I have the option to "Open Console" or "Terminate" to clear the window.



I wasn't aware of Python before the error popped up which leads me to believe a 
third party application used/uses Python in the background.

I installed Python 3.5.0 and I still received the error.  I removed Python 
3.5.0 and I still received the error.  I installed Python 2.7.10 and I still 
received the error.  I removed Python 2.7.10 and I still received the error.

I'm at a loss for options moving forward and the error window popping up every 
20 minutes is not the most ideal situation for teaching via PowerPoint.  

HELP :) If there's a diagnostic report I need to run, please let me know and 
I'll run it.

Thank you in advance,
Brian

--
messages: 252955
nosy: bkbdrummer
priority: normal
severity: normal
status: open
title: A Python runtime not could be located.

___
Python tracker 

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



[issue25392] setup.py --quiet doesn't silence "no previously-included directories" warnings from MANIFEST.in

2015-10-13 Thread Ben Finney

Changes by Ben Finney :


--
nosy: +bignose

___
Python tracker 

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



[issue25395] SIGSEGV using json.tool

2015-10-13 Thread Simonas Kazlauskas

New submission from Simonas Kazlauskas:

cat attachment | python -m json.tool

reliably makes python to SIGSEGV on Arch linux

$ python --version
Python 3.5.0
$ uname -a
Linux kumabox 4.2.2-1-ARCH #1 SMP PREEMPT Tue Sep 29 22:21:33 CEST 2015 x86_64 
GNU/Linux

Does not fail on 2.7.10.

--
components: Library (Lib)
files: ast.json
messages: 252954
nosy: nagisa
priority: normal
severity: normal
status: open
title: SIGSEGV using json.tool
type: crash
versions: Python 3.5
Added file: http://bugs.python.org/file40773/ast.json

___
Python tracker 

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



[issue24980] Allow for providing 'on_new_thread' callback to 'concurrent.futures.ThreadPoolExecutor'

2015-10-13 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +bquinlan

___
Python tracker 

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



[issue24980] Allow for providing 'on_new_thread' callback to 'concurrent.futures.ThreadPoolExecutor'

2015-10-13 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue14574] SocketServer doesn't handle client disconnects properly

2015-10-13 Thread Jason Morawski

Jason Morawski added the comment:

Found another issue with this in 2.7

If the socket.error gets raised from the call to self.wfile.flush(), then when 
self.wfile.close() is called, self.wfile.flush() is called a second time if 
self.wfile._wbuf is not empty. This will raise the socket.error again. 
Attaching a patch that explicitly clears the buffer when the socket.error 
occurs.

--
nosy: +Jason Morawski
Added file: http://bugs.python.org/file40772/clear_buffer_on_error.patch

___
Python tracker 

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



[issue25385] Spurious warning when compiling extension module

2015-10-13 Thread Steve Dower

Steve Dower added the comment:

Issue #23970 added the new compiler class, but all that really changed is that 
the module name is now distutils._msvccompiler. You *still* shouldn't access it 
except through distutils.ccompiler.new_compiler(compiler='msvc'), which is how 
it always was.

I can't point to exactly where in numpy the issue is, but I'd guess it looks a 
lot like "import distutils.msvccompiler"

--

___
Python tracker 

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



[issue24164] Support pickling objects with __new__ with keyword arguments with protocol 2+

2015-10-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks.

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



[issue24164] Support pickling objects with __new__ with keyword arguments with protocol 2+

2015-10-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset de982d8b7b15 by Serhiy Storchaka in branch 'default':
Issue #24164: Document changes to __getnewargs__ and __getnewargs_ex__.
https://hg.python.org/cpython/rev/de982d8b7b15

--

___
Python tracker 

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



[issue25382] pickletools.dis(): output memo id for MEMOIZE

2015-10-13 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
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



[issue25380] Incorrect protocol for the STACK_GLOBAL opcode

2015-10-13 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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



[issue25382] pickletools.dis(): output memo id for MEMOIZE

2015-10-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d88526aa1b29 by Serhiy Storchaka in branch 'default':
Issue #25382: pickletools.dis() now outputs implicit memo index for the
https://hg.python.org/cpython/rev/d88526aa1b29

--
nosy: +python-dev

___
Python tracker 

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



[issue25391] difflib.SequenceMatcher(...).ratio gives bad/wrong/unexpected low value with repetitious strings

2015-10-13 Thread Tim Peters

Tim Peters added the comment:

BTW, the "leftmost longest contiguous" bit is messy to explain, so the main 
part of the docs don't explain it all (it's of no interest to 99.9% of users).  
Instead it's formally defined in the .find_longest_match() docs:

"""
If isjunk was omitted or None, find_longest_match() returns (i, j, k) such that 
a[i:i+k] is equal to b[j:j+k], where alo <= i <= i+k <= ahi and blo <= j <= j+k 
<= bhi. For all (i', j', k') meeting those conditions, the additional 
conditions k >= k', i <= i', and if i == i', j <= j' are also met. In other 
words, of all maximal matching blocks, return one that starts earliest in a, 
and of all those maximal matching blocks that start earliest in a, return the 
one that starts earliest in b.
"""

--

___
Python tracker 

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



[issue25380] Incorrect protocol for the STACK_GLOBAL opcode

2015-10-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e52f1fa2d10e by Serhiy Storchaka in branch '3.4':
Issue #25380: Fixed protocol for the STACK_GLOBAL opcode in
https://hg.python.org/cpython/rev/e52f1fa2d10e

New changeset 4115eabc3a6d by Serhiy Storchaka in branch '3.5':
Issue #25380: Fixed protocol for the STACK_GLOBAL opcode in
https://hg.python.org/cpython/rev/4115eabc3a6d

New changeset f584dadc640f by Serhiy Storchaka in branch 'default':
Issue #25380: Fixed protocol for the STACK_GLOBAL opcode in
https://hg.python.org/cpython/rev/f584dadc640f

--
nosy: +python-dev

___
Python tracker 

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



[issue24164] Support pickling objects with __new__ with keyword arguments with protocol 2+

2015-10-13 Thread STINNER Victor

STINNER Victor added the comment:

pickle_new_ex_protocol_2_doc_2.patch looks good to me.

--

___
Python tracker 

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



[issue24164] Support pickling objects with __new__ with keyword arguments with protocol 2+

2015-10-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Documentation patch updated.

--
Added file: 
http://bugs.python.org/file40771/pickle_new_ex_protocol_2_doc_2.patch

___
Python tracker 

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



[issue25391] difflib.SequenceMatcher(...).ratio gives bad/wrong/unexpected low value with repetitious strings

2015-10-13 Thread Tim Peters

Tim Peters added the comment:

Do note that this is not an "edit distance" (like Levenshtein) algorithm.  It 
works as documented instead ;-) , searching (in effect recursively) for the 
leftmost longest contiguous matching blocks.  Both "leftmost" and "contiguous" 
are crucial to understanding what it does.

I expect you're most surprised by the 2nd example, comparing:

location,location,location
location.location,location

The longest contiguous matching block is "location,location", in the first 
string at slice 0:17 (leftmost!) and in the second string at slice 9:26.  That 
leaves a wholly unmatched ",location" at the end of the first string and a 
wholly unmatched "location." at the start of the second string.  That's why the 
ratio is so low.  We have a total of 17*2 = 34 matching characters (in the 
single matching block) out of 2*26 = 52 characters total, so the ratio is 34/52 
~= 0.65.

Had it searched for the _rightmost_ longest matching blocks instead, then the 
trailing "location,location" pieces of both strings would have matched first, 
and then the leading "location" pieces of both strings, giving a ratio of about 
0.96 instead.  Indeed, that's essentially what happens in your 3rd example.

.quick_ratio() and .real_quick_ratio() use entirely different algorithms, and - 
again as documented - their only purpose is to give an upper bound on what 
.ratio() returns (but do so faster).

Anyway, a couple things to take from this:

1. Some apps really want an "edit distance" kind of algorithm instead.  I would 
welcome one, but nobody so far has volunteered to implement one.  "A problem" 
is that there are many such algorithms (e.g., computational biology has driven 
many developments in this area).

2. It's far too late to change what current difflib functions implement.  The 
primary use case for the "leftmost longest contiguous matches" design was to 
improve the quality (as perceived by human eyes) of diffs generated for text 
files containing code (like C or Python source code), and it works very well 
for that purpose most times.  It doesn't work well for all purposes at all 
times.  Note that "works well (as perceived by human eyes)" is largely 
subjective, so arguing about that won't get far ;-)

Since it's functioning as designed & documented, I'm closing this as "not a 
bug".  It may make sense to open a different "enhancement" issue instead asking 
for a different algorithm(s).

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

___
Python tracker 

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



[issue25394] CoroWrapper breaks gen.throw

2015-10-13 Thread Chris Seto

Changes by Chris Seto :


--
keywords: +patch
Added file: http://bugs.python.org/file40770/corowrapper.diff

___
Python tracker 

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



[issue25385] Spurious warning when compiling extension module

2015-10-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Do you have a reference or changeset to point to, so that the Numpy developers 
can understand easily what the issue is?

--

___
Python tracker 

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



[issue25394] CoroWrapper breaks gen.throw

2015-10-13 Thread Chris Seto

New submission from Chris Seto:

When asyncio.coroutines._DEBUG is set to True all coroutines are wrapped in a 
CoroWrapper.
The definition of CoroWrapper.throw only excepts a single argument, exc.
It should accept an exception info tuple as returned from sys.exc_info just as 
normal generators do.

--
components: asyncio
files: example.py
messages: 252942
nosy: Chris Seto, gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: CoroWrapper breaks gen.throw
type: crash
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file40769/example.py

___
Python tracker 

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



[issue25385] Spurious warning when compiling extension module

2015-10-13 Thread Steve Dower

Steve Dower added the comment:

This should be fixed in numpy.distutils. The warning exists in 
distutils.msvccompiler, which is deprecated and only remains in case people 
were importing it directly (the only reference in the stdlib is the test suite).

--

___
Python tracker 

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



[issue21159] configparser.InterpolationMissingOptionError is not very intuitive

2015-10-13 Thread R. David Murray

R. David Murray added the comment:

By the way, I won't argue a lot if you say we should go for the strict backward 
compatibility view even in 3.5, I'm more raising the question.

--

___
Python tracker 

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



[issue21159] configparser.InterpolationMissingOptionError is not very intuitive

2015-10-13 Thread R. David Murray

R. David Murray added the comment:

Or are you saying the existing code is actually depending on the old value of 
rawval, which is what Łukasz was worried about?

--

___
Python tracker 

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



[issue21159] configparser.InterpolationMissingOptionError is not very intuitive

2015-10-13 Thread R. David Murray

R. David Murray added the comment:

OK, so I guess it should be backed out in 3.4.  But the since the patch does 
not change the signature of get, it seems like it is a legitimate change for 
3.5.  It is using the public API, after all.

--

___
Python tracker 

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



[issue25390] Can't define a typing.Union containing a typing.re.Pattern

2015-10-13 Thread Guido van Rossum

Changes by Guido van Rossum :


--
assignee:  -> gvanrossum

___
Python tracker 

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



[issue25390] Can't define a typing.Union containing a typing.re.Pattern

2015-10-13 Thread Guido van Rossum

Guido van Rossum added the comment:

Confirmed. The failure is because Pattern is _TypeAlias, which is not a type. 
But it should be allowed. I'll think of something. (Does mypy accept this?)

--
nosy: +gvanrossum

___
Python tracker 

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



[issue25391] difflib.SequenceMatcher(...).ratio gives bad/wrong/unexpected low value with repetitious strings

2015-10-13 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
nosy: +tim.peters

___
Python tracker 

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



[issue21159] configparser.InterpolationMissingOptionError is not very intuitive

2015-10-13 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

The failure is in the configglue test suite, but apparently also kazan and 
qutebrowser are also affected by this change.  In the Launchpad bug there's a 
link to a librarian build log result.

The problem is that doing the .get() requires that subclasses implement a 
compatible API, which wasn't required previous to this change.  But apparently 
adding the fallback argument to the subclass's .get() doesn't entirely fix the 
problem, it leads to other failures.

--

___
Python tracker 

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



[issue1353344] python.desktop

2015-10-13 Thread Shubham Dash

Changes by Shubham Dash :


Added file: http://bugs.python.org/file40768/python.desktop

___
Python tracker 

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



[issue25393] 'resource' module documentation error

2015-10-13 Thread Christos Georgiou

New submission from Χρήστος Γεωργίου (Christos Georgiou):

https://docs.python.org/3.5/library/resource.html

https://docs.python.org/3.5/library/resource.html#resource.RLIMIT_FSIZE ends 
with the sentence "This only affects the stack of the main thread in a 
multi-threaded process."

I believe this sentence should be appended to 
https://docs.python.org/3.5/library/resource.html#resource.RLIMIT_STACK

This error also exists in previous versions of python documentation.

--
assignee: docs@python
components: Documentation
messages: 252935
nosy: docs@python, tzot
priority: normal
severity: normal
status: open
title: 'resource' module documentation error
type: enhancement
versions: Python 3.5

___
Python tracker 

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



[issue25392] setup.py --quiet doesn't silence "no previously-included directories" warnings from MANIFEST.in

2015-10-13 Thread Ned Batchelder

Ned Batchelder added the comment:

You are right that "develop" is from setuptools.  The same messages appear with 
"sdist":

$ python setup.py --quiet sdist
no previously-included directories found matching 'doc/_build'
no previously-included directories found matching 'tests/eggsrc/dist'
no previously-included directories found matching 'tests/eggsrc/*.egg-info'

--

___
Python tracker 

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



[issue25381] Doc: Use of old description of raise in Python3

2015-10-13 Thread Xiang Zhang

Xiang Zhang added the comment:

Actually what I intend is that the exception object passed to raise is the 
exception instance raise finally throws (what is stored in the second 
variable). So it seems wise not to do any more for me. A single sentence has 
lead to confusion, not to mention more.

--

___
Python tracker 

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



[issue25391] difflib.SequenceMatcher(...).ratio gives bad/wrong/unexpected low value with repetitious strings

2015-10-13 Thread Allan Lewis

Changes by Allan Lewis :


--
nosy: +Allan Lewis

___
Python tracker 

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



[issue9208] SMTPHandler in the logging module does not handle unicode strings

2015-10-13 Thread R. David Murray

R. David Murray added the comment:

To clarify: it will default to utf-8 encoded for email transport.  (Since email 
now supports SMTPUTF8, what I said could have meant defaulting to that, which 
it does *not* do.)

--

___
Python tracker 

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



[issue9208] SMTPHandler in the logging module does not handle unicode strings

2015-10-13 Thread R. David Murray

R. David Murray added the comment:

In 3.4/3.5 a better fix would be to use EmailMessage instead of Message, and 
smtp.send_message instead of smtp.sendmail.  That will do the right thing, 
where "the right thing" is defined as defaulting to utf-8 for both headers and 
body.  A specific application might want other defaults, in which case one 
should proceed as Vinay suggests.

You could open a new issue requesting the use of EmailMessage/send_message in 
python3 logging if you want to pursue this.  Note that this would also allow 
unicode in the display name part of the addresses.

--

___
Python tracker 

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



[issue25381] Doc: Use of old description of raise in Python3

2015-10-13 Thread R. David Murray

R. David Murray added the comment:

There's also the fact that the argument to raise can be an exception class, but 
the second element of sys.exc_info is still an instance of that class, which 
only occurred to me while reading your revised patch.

--
stage: patch review -> needs patch

___
Python tracker 

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



[issue25392] setup.py --quiet doesn't silence "no previously-included directories" warnings from MANIFEST.in

2015-10-13 Thread Ionel Cristian Mărieș

Ionel Cristian Mărieș added the comment:

I think those warning are about the fact that stuff that ain't in the packages 
list are added on PYTHONPATH. Not 100% sure tho.

Nothing to do with MANIFEST.in (not used for develop). Plus it's more specific 
to setuptools (where develop is implemented) than distutils.

--
nosy: +ionelmc

___
Python tracker 

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



[issue9208] SMTPHandler in the logging module does not handle unicode strings

2015-10-13 Thread simon04

simon04 added the comment:

I don't see why/how this should be fixed in Python 3.

Using the example from msg109621 and Python 3.5.0, I get:
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.5/logging/handlers.py", line 985, in emit
smtp.sendmail(self.fromaddr, self.toaddrs, msg)
  File "/usr/lib/python3.5/smtplib.py", line 846, in sendmail
msg = _fix_eols(msg).encode('ascii')
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 
108: ordinal not in range(128)
Call stack:
  File "/tmp/x.py", line 8, in 
LOG.error(u"accentu\u00E9")
Message: 'accentué'
Arguments: ()

The problem is that an SMTP message is constructed and non-ASCII characters are 
not escaped in SMTPHandler.emit. A robust fix would be to use 
email.mime.text.MIMEText instead:

msg = MIMEText(msg)
msg['Subject'] = self.getSubject(record)
msg['From'] = self.fromaddr
msg['To'] = ",".join(self.toaddrs)

--
nosy: +simon04

___
Python tracker 

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



[issue25390] Can't define a typing.Union containing a typing.re.Pattern

2015-10-13 Thread Martí Congost Tapias

Changes by Martí Congost Tapias :


--
components: +Library (Lib) -Interpreter Core

___
Python tracker 

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



[issue25392] setup.py --quiet doesn't silence "no previously-included directories" warnings from MANIFEST.in

2015-10-13 Thread Ned Batchelder

New submission from Ned Batchelder:

The MANIFEST.in file for coverage.py excludes directories line doc/_build.  If 
I run "python setup.py --quiet develop", I get output like this:

python3.5 setup.py --quiet develop
no previously-included directories found matching 'doc/_build'
no previously-included directories found matching 'tests/eggsrc/dist'
no previously-included directories found matching 'tests/eggsrc/*.egg-info'

This is because I'm running the command in a working tree that hasn't had the 
docs built yet.  But I need MANIFEST.in to exclude that directory for the case 
where I do run the command in dirty tree.

1) Why is it a warning to exclude directories that don't exist in the first 
place?  That's not a problem.

2) Why doesn't --quiet silence those warnings?

--
messages: 252927
nosy: nedbat
priority: normal
severity: normal
status: open
title: setup.py --quiet doesn't silence "no previously-included directories" 
warnings from MANIFEST.in
versions: Python 2.7, Python 3.3, 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



[issue25389] It crashes as long as I press "(parenthese)

2015-10-13 Thread Ned Deily

Ned Deily added the comment:

Unfortunately, the version of Tcl/Tk shipped by Apple in OS X is old and buggy. 
 Please install an updated version of Tcl/Tk 8.5, for example from ActiveState, 
as explained here:

https://www.python.org/download/mac/tcltk/

--
resolution:  -> third party
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



[issue25391] difflib.SequenceMatcher(...).ratio gives bad/wrong/unexpected low value with repetitious strings

2015-10-13 Thread Lewis Haley

Changes by Lewis Haley :


--
title: difflib.SequenceMatcher(...).ratio gives bad/wrong/unexpected low value 
with repetitous strings -> difflib.SequenceMatcher(...).ratio gives 
bad/wrong/unexpected low value with repetitious strings

___
Python tracker 

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



[issue25391] difflib.SequenceMatcher(...).ratio gives bad/wrong/unexpected low value with repetitous strings

2015-10-13 Thread Lewis Haley

New submission from Lewis Haley:

Consider the following snippet:

import difflib

first = u'location,location,location'
for second in (
u'location.location.location',  # two periods (no commas)
u'location.location,location',  # period after first
u'location,location.location',  # period after second
u'location,location,location',  # perfect match
):
edit_dist = difflib.SequenceMatcher(None, first, second).ratio()
print("comparing %r vs. %r gives edit dist: %g" % (first, second, 
edit_dist))

I would expect the second and third tests to give the same result, but in 
reality:

comparing u'location,location,location' vs. u'location.location.location' gives 
edit dist: 0.923077
comparing u'location,location,location' vs. u'location.location,location' gives 
edit dist: 0.653846
comparing u'location,location,location' vs. u'location,location.location' gives 
edit dist: 0.961538
comparing u'location,location,location' vs. u'location,location,location' gives 
edit dist: 1

The same results are received from Python 3.4.

>From experimenting, it seems that when the period comes after the first 
>"location", the longest match found is the final two "locations" from the 
>first string against the first two "locations" from the second string.

In [31]: difflib.SequenceMatcher(None, u'location,location,location', 
u'location.location,location').ratio()
Out[31]: 0.6538461538461539

In [32]: difflib.SequenceMatcher(None, u'location,location,location', 
u'location.location,location').get_matching_blocks()
Out[32]: [Match(a=0, b=9, size=17), Match(a=26, b=26, size=0)]

In [33]: difflib.SequenceMatcher(None, u'location,location,location', 
u'location,location.location').ratio()Out[33]: 0.9615384615384616

In [34]: difflib.SequenceMatcher(None, u'location,location,location', 
u'location,location.location').get_matching_blocks()
Out[34]: 
[Match(a=0, b=0, size=17),
 Match(a=18, b=18, size=8),
 Match(a=26, b=26, size=0)]

Using `quick_ratio` instead of `ratio` gives (what I consider to be) the 
correct result.

--
components: Library (Lib)
files: test.py
messages: 252925
nosy: Lewis Haley
priority: normal
severity: normal
status: open
title: difflib.SequenceMatcher(...).ratio gives bad/wrong/unexpected low value 
with repetitous strings
versions: Python 2.7, Python 3.4
Added file: http://bugs.python.org/file40767/test.py

___
Python tracker 

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



[issue25390] Can't define a typing.Union containing a typing.re.Pattern

2015-10-13 Thread Xiang Zhang

Changes by Xiang Zhang <18518281...@126.com>:


--
nosy: +xiang.zhang

___
Python tracker 

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



[issue24164] Support pickling objects with __new__ with keyword arguments with protocol 2+

2015-10-13 Thread STINNER Victor

STINNER Victor added the comment:

Serhiy Storchaka added the comment:
> Could you please look at proposed documentation changes?

Sure, done.

--

___
Python tracker 

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



[issue25390] Can't define a typing.Union containing a typing.re.Pattern

2015-10-13 Thread Martí Congost Tapias

New submission from Martí Congost Tapias:

Defining a union of typing.re.Pattern and anything that isn't AnyStr raises a 
TypeError exception.

Example:

from typing import Union, re

def foo(pattern: Union[str, re.Pattern]) -> None:
pass

Exception traceback:

Traceback (most recent call last):
  File "/tmp/testtyping.py", line 7, in 
def foo(pattern: Union[str, re.Pattern]) -> None:
  File "/usr/local/lib/python3.5/typing.py", line 534, in __getitem__
dict(self.__dict__), parameters, _root=True)
  File "/usr/local/lib/python3.5/typing.py", line 491, in __new__
for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
  File "/usr/local/lib/python3.5/typing.py", line 491, in 
for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
TypeError: issubclass() arg 1 must be a class

--
components: Interpreter Core
messages: 252923
nosy: Martí Congost Tapias
priority: normal
severity: normal
status: open
title: Can't define a typing.Union containing a typing.re.Pattern
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



[issue25389] It crashes as long as I press "(parenthese)

2015-10-13 Thread IvenDong

New submission from IvenDong:

Process:   Python [1100]
Path:  /Applications/Python 3.5/IDLE.app/Contents/MacOS/Python
Identifier:org.python.IDLE
Version:   3.5.0rc4 (3.5.0rc4)
Code Type: X86 (Native)
Parent Process:??? [1]
Responsible:   Python [1100]
User ID:   501

Date/Time: 2015-10-11 22:35:09.054 +0800
OS Version:Mac OS X 10.11 (15A284)
Report Version:11
Anonymous UUID:4F4BFD63-E728-8F3C-E2C5-390C0FDD071E


Time Awake Since Boot: 9000 seconds

System Integrity Protection: enabled

Crashed Thread:0  Dispatch queue: com.apple.main-thread

Exception Type:EXC_BREAKPOINT (SIGTRAP)
Exception Codes:   0x0002, 0x
Exception Note:EXC_CORPSE_NOTIFY

Application Specific Information:
*** Terminating app due to uncaught exception 'NSRangeException', reason: 
'-[__NSCFConstantString characterAtIndex:]: Range or index out of bounds'

Application Specific Backtrace 1:
0   CoreFoundation  0x9dbe59b9 __raiseError + 201
1   libobjc.A.dylib 0x9def1f11 objc_exception_throw + 276
2   CoreFoundation  0x9dbe58cd +[NSException raise:format:] 
+ 141
3   CoreFoundation  0x9dae0bcf -[__NSCFString 
characterAtIndex:] + 111
4   Tk  0x01b0dedd TkpInitKeymapInfo + 659
5   Tk  0x01b09aab TkpRedirectKeyEvent + 1270
6   Tk  0x01b14490 Tk_MacOSXSetupTkNotifier + 
986
7   Tcl 0x019e77ac Tcl_DoOneEvent + 310
8   _tkinter.cpython-35m-darwin.so  0x0195d589 _tkinter_tkapp_mainloop + 233
9   Python  0x00067dcd PyCFunction_Call + 237
10  Python  0x000f3364 PyEval_EvalFrameEx + 31972
11  Python  0x000f586c _PyEval_EvalCodeWithName + 
2284
12  Python  0x000f3ed5 PyEval_EvalFrameEx + 34901
13  Python  0x000f586c _PyEval_EvalCodeWithName + 
2284
14  Python  0x000f3ed5 PyEval_EvalFrameEx + 34901
15  Python  0x000f586c _PyEval_EvalCodeWithName + 
2284
16  Python  0x000f5a13 PyEval_EvalCode + 99
17  Python  0x0012457e PyRun_FileExFlags + 206
18  Python  0x001248a9 PyRun_SimpleFileExFlags + 505
19  Python  0x0013e4b8 Py_Main + 3704
20  Python  0x1e97 main + 471
21  Python  0x1cb5 start + 53

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.apple.CoreFoundation  0x9dbe5d37 
___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___ + 7
1   com.apple.CoreFoundation  0x9dbe5cc2 __raiseError + 978
2   libobjc.A.dylib   0x9def1f11 objc_exception_throw + 276
3   com.apple.CoreFoundation  0x9dbe58cd +[NSException raise:format:] + 
141
4   com.apple.CoreFoundation  0x9dae0bcf -[__NSCFString 
characterAtIndex:] + 111
5   Tk0x01b0dedd 0x1a4f000 + 782045
6   Tk0x01b09aab 0x1a4f000 + 764587
7   Tk0x01b14490 0x1a4f000 + 808080
8   Tcl   0x019e77ac Tcl_DoOneEvent + 310
9   _tkinter.cpython-35m-darwin.so0x0195d589 _tkinter_tkapp_mainloop + 233
10  org.python.python 0x00067dcd PyCFunction_Call + 237
11  org.python.python 0x000f3364 PyEval_EvalFrameEx + 31972
12  org.python.python 0x000f586c _PyEval_EvalCodeWithName + 2284
13  org.python.python 0x000f3ed5 PyEval_EvalFrameEx + 34901
14  org.python.python 0x000f586c _PyEval_EvalCodeWithName + 2284
15  org.python.python 0x000f3ed5 PyEval_EvalFrameEx + 34901
16  org.python.python 0x000f586c _PyEval_EvalCodeWithName + 2284
17  org.python.python 0x000f5a13 PyEval_EvalCode + 99
18  org.python.python 0x0012457e PyRun_FileExFlags + 206
19  org.python.python 0x001248a9 PyRun_SimpleFileExFlags + 505
20  org.python.python 0x0013e4b8 Py_Main + 3704
21  Python0x1e97 main + 471
22  Python0x1cb5 start + 53

Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0   libsystem_kernel.dylib0x9c34c8b2 kevent_qos + 10
1   libdispatch.dylib 0x9bb91836 _dispatch_mgr_invoke + 234
2   libdispatch.dylib 0x9bb9140a _dispatch_mgr_thread + 52

Thread 2:
0   libsystem_kernel.dylib0x9c34be16 __workq_kernreturn + 10
1   libsystem_pthread.dylib   0x9c65d35f _pthread_wqthread + 1289
2   libsystem_pthread.dylib 

[issue25386] msvcrt_putch/msvcrt_putwch don't check the return value of _putch/_putwch

2015-10-13 Thread Eric V. Smith

Eric V. Smith added the comment:

Although the function names have changed (I think due to Argument Clinic), the 
reported issue still applies to the current code:

https://hg.python.org/cpython/file/tip/PC/msvcrtmodule.c#l309

I'll let other decide if the change is actually desirable. It would be 
interesting to know under what circumstances these functions can fail.

--
keywords: +easy
nosy: +eric.smith
stage:  -> needs patch

___
Python tracker 

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



[issue25384] Use _PyBytesWriter in the binascii module

2015-10-13 Thread STINNER Victor

Changes by STINNER Victor :


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



[issue25384] Use _PyBytesWriter in the binascii module

2015-10-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d6fcda2b9b5e by Victor Stinner in branch 'default':
Issue #25384: Use _PyBytesWriter API in binascii
https://hg.python.org/cpython/rev/d6fcda2b9b5e

--
nosy: +python-dev

___
Python tracker 

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



[issue22684] message.as_bytes() produces recursion depth exceeded

2015-10-13 Thread Jan Malte

Jan Malte added the comment:

Are there any news about this bug report?

--
nosy: +janmalte

___
Python tracker 

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