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

2016-02-26 Thread Michael Felt

Changes by Michael Felt :


--
title: ctypes.util.find_library fails ALWAYS when gcc is not used -> 
ctypes.util.find_library fails when ldconfig/glibc not available (e.g., AIX)

___
Python tracker 

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



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

2016-02-26 Thread Michael Felt

Michael Felt added the comment:

The _dlopen call in __init__.py I have been able to fix (hack) with the 
following:

root@x064:[/data/prj/aixtools/python/python-2.7.10/Lib/ctypes]diff -u 
__init__.py /opt/lib/python2.7/ctypes/__init__.py
--- __init__.py 2015-05-23 16:09:01 +
+++ /opt/lib/python2.7/ctypes/__init__.py   2016-02-26 08:40:19 +
@@ -11,6 +11,7 @@
 from _ctypes import _Pointer
 from _ctypes import CFuncPtr as _CFuncPtr
 from _ctypes import __version__ as _ctypes_version
+# from _ctypes import RTLD_LOCAL, RTLD_GLOBAL, RTLD_NOW ## fails
 from _ctypes import RTLD_LOCAL, RTLD_GLOBAL
 from _ctypes import ArgumentError
 
@@ -32,6 +33,11 @@
 if int(_os.uname()[2].split('.')[0]) < 8:
 DEFAULT_MODE = RTLD_GLOBAL
 
+if _os.name == "posix" and _sys.platform.startswith("aix"):
+RTLD_NOW= 0x0002
+RTLD_MEMBER = 0x0004
+DEFAULT_MODE |= (RTLD_NOW | RTLD_MEMBER)
+
 from _ctypes import FUNCFLAG_CDECL as _FUNCFLAG_CDECL, \
  FUNCFLAG_PYTHONAPI as _FUNCFLAG_PYTHONAPI, \
  FUNCFLAG_USE_ERRNO as _FUNCFLAG_USE_ERRNO, \

I have an additional hack in util.py so that, e.g.,
find_Library("crypto")

returns:
 '/usr/lib/libcrypto.a(libcrypto.so)'

When that is passed to dlopen (plus RTLD_MEMBER) the dlopen succeeds.



With some help in util.py, to do some sensible searching, being able to 
establish if in 32 or 64-bit mode, etc. somehing nice can be made here (imho).

p.s. can any verify whether this is limited to python 2.7? Or should python 3.X 
be added as well?

--

___
Python tracker 

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



[issue25939] _ssl.enum_certificates() fails with ERROR_ACCESS_DENIED if python.exe run with low integrity level

2016-02-26 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

Thanks for accepting my patch. I'm curious: any reason not applying to 2.7 
branch? We're building youtube-dl.exe with py2exe on Python 2.7 as py2exe on 
3.x sometimes fails. (https://github.com/rg3/youtube-dl/issues/5094)

--

___
Python tracker 

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



[issue26442] Doc refers to xmlrpc.client but means xmlrpc.server

2016-02-26 Thread ProgVal

New submission from ProgVal:

The doc of xmlrpc.server and xmlrpc.client both warn about XML vulnerabilities.

However, both say “The xmlrpc.client module is not secure”, whereas the page 
for xml.server should say xmlrpc.server.

--
assignee: docs@python
components: Documentation
messages: 260892
nosy: Valentin.Lorentz, docs@python
priority: normal
severity: normal
status: open
title: Doc refers to xmlrpc.client but means xmlrpc.server
versions: 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



[issue26421] string_richcompare invalid check Py_NotImplemented

2016-02-26 Thread yuriy_levchenko

yuriy_levchenko added the comment:

because,

PyObject_GetAttr(PyObject *v, PyObject *name)

have this code

if (!PyString_Check(name)) {

and 

PyDict_GetItem(PyObject *op, PyObject *key)

have this code

if (!PyString_CheckExact(key) ||
(hash = ((PyStringObject *) key)->ob_shash) == -1)
{
hash = PyObject_Hash(key);

next

lookdict_string(PyDictObject *mp, PyObject *key, register long hash)

if (!PyString_CheckExact(key)) {
#ifdef SHOW_CONVERSION_COUNTS
++converted;
#endif
mp->ma_lookup = lookdict;
return lookdict(mp, key, hash);
}

next

PyObject_RichCompare(PyObject *v, PyObject *w, int op)

and 

try_rich_compare(PyObject *v, PyObject *w, int op)

we have this code

if ((f = RICHCOMPARE(v->ob_type)) != NULL) {
res = (*f)(v, w, op);
if (res != Py_NotImplemented)
return res;
Py_DECREF(res);
}
if ((f = RICHCOMPARE(w->ob_type)) != NULL) {
return (*f)(w, v, _Py_SwappedOp[op]);
}

v - PyStringObject
w - MyType

MyType have Py_TPFLAGS_HAVE_RICHCOMPARE and correct test with PyStringObject

but string_richcompare incorrect test type for object, and this code

a->ob_sval 

may cause "access violation" and crach!

if i replace PyString_Check on PyString_CheckExact, all work fine and correct!

--

___
Python tracker 

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



[issue26443] cross building extensions picks up host headers

2016-02-26 Thread Martin Hundebøll

New submission from Martin Hundebøll:

When cross building python, the building of extensions is called with 
-I/usr/include and -L/usr/lib

This makes some extensions fail to compile due to picking up inline assembly 
from host headers (e.g. _socket[1]).

I have fixed this locally by applying the attached patch, but I cannot tell if 
that would make other builds fail.

[1] log output:
building '_socket' extension
arm-cortexa9neon-linux-gnueabi-gcc -fPIC -Wno-unused-result -Wsign-compare 
-Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes 
-I/home/mnhu/projects/pil/oe/tmp/work/machine/arm-cortexa9neon-linux-gnueabi/python-3.5.1/stage/machine/usr/lib/libffi-3.2.1/include
 -O2 -fexpensive-optimizations -fomit-frame-pointer -frename-registers 
-Werror=declaration-after-statement -I./Include -I/usr/include -I. -IInclude 
-I/home/mnhu/projects/pil/oe/tmp/work/machine/arm-cortexa9neon-linux-gnueabi/python-3.5.1/stage/cross/bin/../arm-cortexa9neon-linux-gnueabi/sysroot/usr/include
 
-I/home/mnhu/projects/pil/oe/tmp/work/machine/arm-cortexa9neon-linux-gnueabi/python-3.5.1/src/Python-3.5.1/Include
 
-I/home/mnhu/projects/pil/oe/tmp/work/machine/arm-cortexa9neon-linux-gnueabi/python-3.5.1/src/Python-3.5.1
 -c 
/home/mnhu/projects/pil/oe/tmp/work/machine/arm-cortexa9neon-linux-gnueabi/python-3.5.1/src/Python-3.5.1/Modules/socketmodule.c
 -o 
build/temp.linux-arm-3.5/home/mnhu/projects/pil/oe/tmp/work/machine/arm-cortexa9neon-linux-gnueabi/python-3.5.1/src/Python-3.5.1/Modules/socketmodule.o
In file included from /usr/include/bits/byteswap.h:35:0,
 from /usr/include/endian.h:60,
 from /usr/include/bits/string2.h:51,
 from /usr/include/string.h:635,
 from ./Include/Python.h:30,
 from 
/home/mnhu/projects/pil/oe/tmp/work/machine/arm-cortexa9neon-linux-gnueabi/python-3.5.1/src/Python-3.5.1/Modules/socketmodule.c:95:
/home/mnhu/projects/pil/oe/tmp/work/machine/arm-cortexa9neon-linux-gnueabi/python-3.5.1/src/Python-3.5.1/Modules/socketmodule.c:
 In function 'socket_getservbyport':
/usr/include/bits/byteswap-16.h:31:5: error: invalid 'asm': invalid operand for 
code 'w'
 __asm__ ("rorw $8, %w0"   \
 ^
/usr/include/netinet/in.h:403:21: note: in expansion of macro '__bswap_16'
 #   define htons(x) __bswap_16 (x)
 ^
/home/mnhu/projects/pil/oe/tmp/work/machine/arm-cortexa9neon-linux-gnueabi/python-3.5.1/src/Python-3.5.1/Modules/socketmodule.c:4861:24:
 note: in expansion of macro 'htons'
 sp = getservbyport(htons((short)port), proto);
^

--
components: Cross-Build
files: include-dirs.patch
keywords: patch
messages: 260894
nosy: hundeboll
priority: normal
severity: normal
status: open
title: cross building extensions picks up host headers
type: compile error
versions: Python 2.7, Python 3.5
Added file: http://bugs.python.org/file42032/include-dirs.patch

___
Python tracker 

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



[issue26434] multiprocessing cannot spawn grandchild from a Windows service

2016-02-26 Thread Davin Potts

Davin Potts added the comment:

I can reproduce the problem under Windows 7.  Thank you for your example and 
description -- they were very helpful.

Detection that the original parent was PythonService.exe is necessary to avoid 
undoing the paths set appropriately for running under a service.  The current 
code only detects the immediate parent.

Modifying get_preparation_data() in lib/multiprocessing/forking.py to perform 
an additional test on the inherited values from the original parent's sys.argv 
(available via the preparation_data key 'sys_argv') would resolve this:
if not d['sys_argv'][0].lower().endswith("pythonservice.exe"):


Potential complications to existing code appear very unlikely given its nature.

Patch forthcoming after running tests unless someone wants to beat me to it.

--
assignee:  -> davin
nosy: +davin
stage:  -> needs patch
type: crash -> behavior

___
Python tracker 

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



[issue26195] Windows frozen .exe multiprocessing.Queue access is denied exception

2016-02-26 Thread Davin Potts

Davin Potts added the comment:

Using tools like pyinstaller (and other competing frozen-exe-creating tools) 
unfortunately complicates things for multiprocessing to understand the 
environment it's now in.  It is unclear from this description whether this 
should be regarded as an issue to be addressed in pyinstaller or in 
multiprocessing itself.  Any further information along these lines would be 
much appreciated.

--
nosy: +davin

___
Python tracker 

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



[issue26444] Fix 2 typos on ElementTree docs

2016-02-26 Thread Ismail s

New submission from Ismail s:

'incrementall' has been changed to 'incrementally' (and text reflowed).
'keywword' has been changed to 'keyword'.

--
assignee: docs@python
components: Documentation
files: work.patch
keywords: patch
messages: 260897
nosy: Ismail s, docs@python
priority: normal
severity: normal
status: open
title: Fix 2 typos on ElementTree docs
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file42033/work.patch

___
Python tracker 

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



[issue26432] Add partial.kwargs

2016-02-26 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

-1 "foolish consistency" and all that ...

In the context of partial, it is fairly clear that "keywords" means "keyword 
arguments" while it may not be as clear in other more specialized contexts.  In 
the age of autocompletion almost everywhere, aliases are harmful because they 
result in user seeing redundant choices.

--
nosy: +belopolsky

___
Python tracker 

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



[issue26444] Fix 2 typos on ElementTree docs

2016-02-26 Thread Georg Brandl

Georg Brandl added the comment:

Reflow is kinda bad for patch review :)

--
nosy: +georg.brandl

___
Python tracker 

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



[issue26444] Fix 2 typos on ElementTree docs

2016-02-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 29beb1554dec by Georg Brandl in branch '3.5':
Closes #26444: typo fixes.
https://hg.python.org/cpython/rev/29beb1554dec

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

___
Python tracker 

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



[issue26442] Doc refers to xmlrpc.client but means xmlrpc.server

2016-02-26 Thread Georg Brandl

Georg Brandl added the comment:

Thanks!

--
nosy: +georg.brandl

___
Python tracker 

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



[issue25939] _ssl.enum_certificates() fails with ERROR_ACCESS_DENIED if python.exe run with low integrity level

2016-02-26 Thread Steve Dower

Steve Dower added the comment:

It was fixed in 2.7 - https://hg.python.org/cpython/rev/3cddcf471c70

The issue number wasn't in the commit, so it didn't appear here.

--

___
Python tracker 

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



[issue26442] Doc refers to xmlrpc.client but means xmlrpc.server

2016-02-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9b240ec2bd42 by Georg Brandl in branch '3.5':
Closes #26442: fix copy-paste.
https://hg.python.org/cpython/rev/9b240ec2bd42

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

___
Python tracker 

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



[issue25910] Fixing links in documentation

2016-02-26 Thread Georg Brandl

Changes by Georg Brandl :


--
status: languishing -> open

___
Python tracker 

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



[issue26445] setup.py sdist mishandles package_dir option

2016-02-26 Thread glep

New submission from glep:

Suppose I have a setup.py with the option

   ...
   packages=['package', 'package.utils'],
   package_dir={'package.utils', '../utils'},
   ...

as would arise if ../utils was a package shared between several projets 
('package', 'package1', ...).

I would expect the source distribution created by 'python setup.py sdist'
to create an archive with the following structure:

   /
   |-- package/
   |-- package/utils

And this is indeed what *bdist* does. BUT *sdist* copies '../utils' in 
'package/../utils' instead of 'package/utils', with the result that utils is 
outside of the distribution altogether. 

The issue is referenced in a couple of StackOverflow posts that have attracted 
little attention so far, for example:

http://stackoverflow.com/questions/35510972/inconsistent-behaviour-of-bdist-vs-sdist-when-distributing-a-python-package

--
components: Distutils
messages: 260904
nosy: dstufft, eric.araujo, glep
priority: normal
severity: normal
status: open
title: setup.py sdist mishandles package_dir option
type: behavior
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



[issue25910] Fixing links in documentation

2016-02-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ce5ef48b5140 by Georg Brandl in branch '3.5':
Closes #25910: fix dead and permanently redirected links in the docs. Thanks to 
SilentGhost for the patch.
https://hg.python.org/cpython/rev/ce5ef48b5140

--
nosy: +python-dev
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



[issue25910] Fixing links in documentation

2016-02-26 Thread Georg Brandl

Georg Brandl added the comment:

Reopening, for fixing the rest of the broken ones.

--
nosy: +georg.brandl
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue26446] Mention in the devguide that core devs are expected to follow the PSF CoC

2016-02-26 Thread Brett Cannon

New submission from Brett Cannon:

It should be mentioned in the devguide that receiving one's core developer 
privileges includes following the PSF CoC 
(https://www.python.org/psf/codeofconduct/).

--
components: Devguide
messages: 260907
nosy: brett.cannon, ezio.melotti, willingc
priority: normal
severity: normal
stage: needs patch
status: open
title: Mention in the devguide that core devs are expected to follow the PSF CoC

___
Python tracker 

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



[issue26447] rstrip() is pilfering my 'p'

2016-02-26 Thread Jerod “j3rd” Gawne

New submission from Jerod “j3rd” Gawne:

Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:54:25) [MSC v.1900 64 bit 
(AMD64)] on win32

In[4]: str = 'aaap.py'
In[5]: print(str.rstrip('.py'))
aaa

In[6]: str = 'aaap.pdf'
In[7]: print(str.rstrip('.pdf'))
aaa

In[8]: str = 'aaab.pdf'
In[9]: print(str.rstrip('.pdf'))
aaab

In[10]: str = 'apapapab.pdf'
In[11]: print(str.rstrip('.pdf'))
apapapab

In[12]: str = 'apapapap.pdf'
In[13]: print(str.rstrip('.pdf'))
apapapa

what's with the 'p' pilfering?

In[14]: str = 'apapapab.bdf'
In[15]: print(str.rstrip('.bdf'))
apapapa
In[16]: print(str.rstrip(r'.bdf'))
apapapa

In[18]: print(str.rstrip('\.bdf'))
apapapa

Actually though, it's grabbing an additional character before the '.' the same 
as the one after.

--
messages: 260908
nosy: Jerod “j3rd” Gawne
priority: normal
severity: normal
status: open
title: rstrip() is pilfering my 'p'
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



[issue26447] rstrip() is pilfering my 'p'

2016-02-26 Thread Ethan Furman

Ethan Furman added the comment:

https://docs.python.org/3/library/stdtypes.html#str.strip
-
[...] The chars argument is not a prefix or suffix; rather, all combinations of 
its values are stripped:

--
nosy: +ethan.furman
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

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



[issue26447] rstrip() is pilfering my 'p'

2016-02-26 Thread Eryk Sun

Changes by Eryk Sun :


--
stage:  -> resolved

___
Python tracker 

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



[issue26446] Mention in the devguide that core devs are expected to follow the PSF CoC

2016-02-26 Thread Ezio Melotti

Changes by Ezio Melotti :


--
keywords: +easy
type:  -> enhancement

___
Python tracker 

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



[issue24421] Race condition compiling Modules/_math.c

2016-02-26 Thread Martin Panter

Changes by Martin Panter :


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



[issue26434] multiprocessing cannot spawn grandchild from a Windows service

2016-02-26 Thread Davin Potts

Davin Potts added the comment:

Attached is a patch for the 2.7 branch which adds the check described in the 
previous message.

I don't see a reasonable way to provide an accompanying test because it 
requires registering a win32 service (requiring administrative privileges) 
temporarily to attempt to provoke the issue.

Can I request that someone else run the full regression tests on this patch?  I 
am unable to complete a standard run of tests as my Windows 7 development 
system is set up for building Python 3.x (newer Visual Studio) and am hesitant 
to fight with Visual Studio configurations.

--
keywords: +patch
stage: needs patch -> patch review
Added file: 
http://bugs.python.org/file42034/issue_26434_fix_win32_service_parent_origin.patch

___
Python tracker 

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



[issue18199] Windows: support path longer than 260 bytes using "\\?\" prefix

2016-02-26 Thread Ugra Dániel

Changes by Ugra Dániel :


--
nosy: +daniel.ugra

___
Python tracker 

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



[issue25340] libraries variable in setup.py ignore for multiprocessing module

2016-02-26 Thread Davin Potts

Davin Potts added the comment:

Closing as the original reporter has not responded to requests for additional 
information after 4.5 months.

--
resolution:  -> out of date
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue6143] IDLE - an extension to clear the shell window

2016-02-26 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This issue is lower priority to me than many others, but there does seem to be 
at least some demand shown on Stackoverflow.  So I have not dismissed it 
completely.

--

___
Python tracker 

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



[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Eric Fahlgren

New submission from Eric Fahlgren:

When trying out dis.dis on some synthetically long functions, I noted that 
spurious branch targets were being generated in the output.  First one is at 
address 8:

157   0 LOAD_CONST   1 (1)
  3 DUP_TOP
  4 STORE_FAST   0 (z)
  7 DUP_TOP
>>8 STORE_FAST   1 (a)
 11 DUP_TOP

I dug into findlabels and notices that it pays no attention to EXTENDED_ARG.  
The fix is pretty simple, basically copy pasta from 
dis._get_instructions_bytes, at line 369, in the 3.5.1 release code add all the 
"extended_arg" bits:

extended_arg = 0
while i < n:
op = code[i]
i = i+1
if op >= HAVE_ARGUMENT:
arg = code[i] + code[i+1]*256 + extended_arg
extended_arg = 0
i = i+2
if op == EXTENDED_ARG:
 extended_arg = arg*65536
label = -1

--
components: Library (Lib)
messages: 260913
nosy: eric.fahlgren
priority: normal
severity: normal
status: open
title: dis.findlabels ignores EXTENDED_ARG
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



[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Joe Jevnik

Changes by Joe Jevnik :


--
nosy: +ll

___
Python tracker 

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



[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Barun Parruck

Barun Parruck added the comment:

I'll take a look at it! :) Would you like unit tests as well?

--
nosy: +Barun Parruck

___
Python tracker 

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



[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Barun Parruck

Barun Parruck added the comment:

Hi, to check if I've done things right, which functions did you try out dis.dis 
on?

--

___
Python tracker 

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



[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Eric Fahlgren

Eric Fahlgren added the comment:

My test case:

def long():
z = a = b = c = d = e = f = g = h = 1
while x:
x = x if x and x or not x else x
above line repeated 2999 more times

import dis
print(dis.findlabels(long.__code__.co_code)[:10])

Buggy output:
[35510, 35509, 62, 69, 78, 81, 93, 100, 109, 112]

Correct output:
[101046, 101045, 62, 69, 78, 81, 93, 100, 109, 112]

--

___
Python tracker 

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



[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Eric Fahlgren

Eric Fahlgren added the comment:

Our paths crossed, I don't know exactly how you'd add a test case for this, 
maybe construct the monster function in a string, eval the string, the use the 
synthesized function in dis.findlabels?

--

___
Python tracker 

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



[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Barun Parruck

Barun Parruck added the comment:

Allright, so I'm uploading a preliminary patch, please look through it to see 
if I understood what you meant me to do about dis.findlabels.

The tests seem to mostly pass, except oddly enough, urlstdlib2, which is 
probably system-specific?

I get the correct output that you specify for that particular test function.

I'll see about building a unit test.

--

___
Python tracker 

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



[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Eric Fahlgren

Eric Fahlgren added the comment:

Well, now that I'm thinking about it, you could synthesize a bytecode stream 
trivially and have a much better test.  This is completely off the top of my 
head, so take it is guaranteed to (probably) not work as written, but it should 
get you started:

from opcodes import *
import dis
bytecode = (
chr(EXTENDED_ARG) + chr(1) + chr(0) + 
chr(JUMP_IF_TRUE_OR_POP) + chr(0) + chr(0)
)
print(dis.findlabels(bytecode))

--

___
Python tracker 

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



[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Barun Parruck

Barun Parruck added the comment:

The patch I forgot to attach. Ha ha.

--
keywords: +patch
Added file: http://bugs.python.org/file42035/preliminarypatch.diff

___
Python tracker 

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



[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Barun Parruck

Barun Parruck added the comment:

Hi, I'm a little confused as to how to write a test using bytecode 
streams...probably due to my lack of clarity as to what exactly dis.disassemble 
does. Is there any way you could give me a bit more information? :)

--

___
Python tracker 

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



[issue25939] _ssl.enum_certificates() fails with ERROR_ACCESS_DENIED if python.exe run with low integrity level

2016-02-26 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

Didn't see it. Sorry for bothering.

--

___
Python tracker 

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



[issue26246] Code output toggle button uses removed jQuery method

2016-02-26 Thread Liang-Bo Wang

Liang-Bo Wang added the comment:

Just FYI, I applied the patch to the zh-hant translation of the documentation 
and the code output toggle button is back and works as expected.

https://docs.python.org.tw/3/tutorial/introduction.html#numbers

You can see the result of any other page by changing the URL domain from 
docs.python.org to docs.python.org.tw

--

___
Python tracker 

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



[issue26246] Code output toggle button uses removed jQuery method

2016-02-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f0e20d942760 by Ezio Melotti in branch '3.4':
#26246: update copybutton.js after JQuery update.  Patch by Liang-Bo Wang.
https://hg.python.org/cpython/rev/f0e20d942760

New changeset ac175a7af60b by Ezio Melotti in branch '3.5':
#26246: merge with 3.4.
https://hg.python.org/cpython/rev/ac175a7af60b

New changeset 8c0761260d22 by Ezio Melotti in branch 'default':
#26246: merge with 3.5.
https://hg.python.org/cpython/rev/8c0761260d22

New changeset 20b5d153b894 by Ezio Melotti in branch '2.7':
#26246: update copybutton.js after JQuery update.  Patch by Liang-Bo Wang.
https://hg.python.org/cpython/rev/20b5d153b894

--
nosy: +python-dev

___
Python tracker 

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



[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Eric Fahlgren

Eric Fahlgren added the comment:

The findlabels function takes a bytecode array of type bytes, usually the
actual code from a function.  My original test case uses the full Python
compiler from source code to a CodeType object to create the bytecodes
(plus all that other stuff that makes up a function), then extracts just
the interesting part and passes that into findlabels.

The good part is that you can pretend you're the compiler by just putting
the correct bytes into a array and feed it into the various dis functions.
The EXTENDED_ARG operator plays with the operand of the succeeding
instruction, everything else either doesn't have an argument or has two
bytes.

Here's a real test case, I don't know how you write unit tests for the
stdlib, but you can compare the output of the findlabels call with a known
value, and that should get you pretty close.

from opcode import *
code = bytes(
chr(opmap["JUMP_FORWARD"]) + chr(0) + chr(0) +
chr(EXTENDED_ARG) + chr(1) + chr(0) +
chr(opmap["JUMP_FORWARD"]) + chr(0) + chr(0) +
chr(opmap["RETURN_VALUE"]),
encoding="latin-1"
)
import dis
dis.dis(code)
print(dis.findlabels(code))
if dis.findlabels(code) == [0x+3, 0x0001+9]:
print("Test passed")

Take a look in the stdlib opcode.py and find the various "JUMP" operators,
those are the guys we care about for this.  Try out a bunch of cases by
augmenting the above definition of "code" and you'll soon get a feel for
what's going on.

As real, executable bytecode the above is of course non-sensical, but for a
test, it's great because you can predict exactly what should be produced.
​

--

___
Python tracker 

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



[issue26246] Code output toggle button uses removed jQuery method

2016-02-26 Thread Ezio Melotti

Ezio Melotti added the comment:

I applied the patch -- it should go live the next time the docs are updated.  
Thanks for the report and the patch!

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

___
Python tracker 

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



[issue26421] string_richcompare invalid check Py_NotImplemented

2016-02-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

PyDict_GetItem and lookdict_string use PyString_CheckExact for fast path. 
String subclasses are proceeded in general way. PyObject_GetAttr and 
string_richcompare use PyString_Check because they work with string and string 
subclasses. Py_TPFLAGS_STRING_SUBCLASS shouldn't be used if the type is not 
string subclass.

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



[issue26246] Code output toggle button uses removed jQuery method

2016-02-26 Thread Liang-Bo Wang

Liang-Bo Wang added the comment:

Thanks for the merge. 

I pulled the change and checked the result, but I found the patch missing a 
line to initiate the correct display state when the button was created. That 
is, it forgot to set `button.data('hidden', 'false');` when adding the button. 

This causes the first click on the button to have no effect. But the following 
clicks will work.

I filed the new patch to add this line back. I'm so sorry I missed this line :(

--
Added file: http://bugs.python.org/file42036/copybutton_js_2.patch

___
Python tracker 

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



[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Barun Parruck

Barun Parruck added the comment:

Hi, yes, that works much better, and I've definitely understood!

Now, about the tests, how large would you like them to be? For instance :

code = bytes (
chr(opmap["JUMP_FORWARD"]) + chr(0) + chr(255) + 
chr(EXTENDED_ARG) + chr(1) + chr(1) + 
chr(opmap["JUMP_FORWARD"]) + chr(0) + chr(0) +
chr(EXTENDED_ARG) + chr(1) + chr(0) +
chr(opmap["JUMP_ABSOLUTE"]) + chr(0) + chr(1) +
chr(opmap["RETURN_VALUE"]),
encoding="latin-1"
)

Would return [65283, 16842761, 65792]

And I'll make sure I test all the jump instances (I'm shuddering to imagine 
what a real computer would do if fed with those byte codes)

Do you want the tests to be large? (array size > 10^2/2 as a result), or is the 
example above fine, if I add three or four more example testing each jump 
instance?

--

___
Python tracker 

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