[issue29270] super call in ctypes sub-class fails in 3.6

2017-01-14 Thread Dave Jones

Dave Jones added the comment:

I confess I'm going to have to read a bit more about Python internals before I 
can understand Eryk's analysis (this is my first encounter with "cell 
objects"), but many thanks for the rapid analysis and patch!

I'm not too concerned about the state being broken with reversed endianness; I 
don't think that's going to affect any of my use-cases in the near future, but 
it's certainly useful to know in case it does come up.

--

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



[issue29270] super call in ctypes sub-class fails in 3.6

2017-01-13 Thread Dave Jones

New submission from Dave Jones:

While investigating a bug report in one of my libraries 
(https://github.com/waveform80/picamera/issues/355) I've come across a 
behaviour that appears in Python 3.6 but not prior versions. Specifically, 
calling super() in a sub-class of a ctypes scalar type appears to fail at the 
class definition stage. A minimal test case is as follows:

import ctypes as ct

class SuperTest(ct.c_uint32):
def __repr__(self):
return super().__repr__()

This works happily under python 3.2, 3.4, and 3.5 (that I've tested), and also 
under 2.7 (with the appropriate modification to super's arguments). However, 
under 3.6 it elicits the following exception:

Traceback (most recent call last):
  File "py36_ctypes.py", line 3, in 
class SuperTest(ct.c_uint32):
TypeError: __class__ set to  defining 
'SuperTest' as 

Reading through the "What's New" list in 3.6, I thought this might be something 
to do with the PEP-487 implementation (given it modified class construction), 
but having read through the PEP and associated patches I'm not so sure as I 
can't see anything that affects the setting of the "__class__" attribute (but 
don't rule it out on that basis; I'm no expert!).

I'll admit that sub-classing one of ctypes' scalar types is a little odd, but 
given this works in prior versions and there doesn't appear to be anything in 
the documentation banning the practice (that I've found?) this might constitute 
a bug?

--
components: ctypes
messages: 285444
nosy: Dave Jones
priority: normal
severity: normal
status: open
title: super call in ctypes sub-class fails in 3.6
type: behavior
versions: Python 3.6

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



[issue29261] Missing venv/scripts/common after "make install"

2017-01-13 Thread Dave Jones

New submission from Dave Jones:

While attempting to diagnose something (unrelated to this issue) under python 
3.6, I used the following steps to clone and build a non-root python 
installation:

$ mkdir py36
$ hg clone https://hg.python.org/cpython
$ cd cpython
$ hg update 3.6
$ ./configure --prefix=/home/pi/py36
$ make
$ make install

Afterwards I attempted to set up a venv for further testing:

$ /home/pi/py36/bin/python3 -m venv py36env

This succeeded but, unfortunately, activating the venv proved impossible as the 
"activate" script was missing from its "bin" sub-dir. 

After a bit of investigation it appears that "make install" had copied 
"Lib/venv/scripts/posix" but not "Lib/venv/scripts/common" into the 
installation, hence the templates for "activate.csh" and "activate.fish" are 
present, but not the "activate" template.

I had a search around for related issues but only found #22343 which explains 
why "activate" is no longer present (because it's moved from scripts/posix/ to 
scripts/common/) but I don't think is responsible for common not getting copied 
by "make install".

It appears adding "venv/scripts/common" to LIBSUBDIRS in Makefile.pre.in fixes 
the issue (as in the attached patch) but I've no idea if this covers all 
necessary platforms (I'd guess Windows doesn't use the Makefile if #22343 fixed 
things for it?).

--
components: Installation
files: missing_venv_common.diff
keywords: patch
messages: 285403
nosy: Dave Jones
priority: normal
severity: normal
status: open
title: Missing venv/scripts/common after "make install"
type: behavior
versions: Python 3.6, Python 3.7
Added file: http://bugs.python.org/file46280/missing_venv_common.diff

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



[issue25615] Document unsorted behaviour of glob.glob

2015-11-15 Thread Dave Jones

Dave Jones added the comment:

Ah, sorry about that - force of habit. I did wonder if it was preferable to 
have a nicely wrapped patch, or to have a clean diff but obviously figured 
wrong! I'll know for future :)

--

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



[issue25615] Document unsorted behaviour of glob.glob

2015-11-15 Thread Dave Jones

Dave Jones added the comment:

Sounds good; the patch seems to apply cleanly to checkouts of 2.7, 3.4, and 3.5 
so I'm assuming I don't need to do anything else?

--

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



[issue21748] glob.glob does not sort its results

2015-11-13 Thread Dave Jones

Dave Jones added the comment:

As suggested, doc patch attached to new issue 25615.

--

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



[issue25615] Document unsorted behaviour of glob.glob

2015-11-13 Thread Dave Jones

New submission from Dave Jones:

As suggested in issue 21748, this is a minor documentation change to make 
explicitly clear that glob.glob returns unsorted results (on the basis that the 
existing specification references shell behaviour which is always sorted).

--
assignee: docs@python
components: Documentation
files: glob-spec-unsorted.patch
keywords: patch
messages: 254597
nosy: Dave Jones, docs@python
priority: normal
severity: normal
status: open
title: Document unsorted behaviour of glob.glob
type: behavior
versions: Python 3.6
Added file: http://bugs.python.org/file41029/glob-spec-unsorted.patch

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



[issue21748] glob.glob does not sort its results

2015-11-12 Thread Dave Jones

Dave Jones added the comment:

>From the bash man-page: "... If one of these characters appears, then the word 
>is regarded as a pattern, and replaced with an *alphabetically sorted* list of 
>filenames matching the pattern".

I would agree that glob.glob shouldn't sort its results (the overhead may be 
substantial, and there are plenty of use-cases that don't require sorting), but 
given that the documented behaviour is at odds (implicitly via the shell's 
documentation) with the implemented behaviour I would argue that it is 
premature to close this without at least adding a note to the Python docs.

(P.S. in case my comment is received poorly, I'm not the original author of 
this ticket, and no aspersions should be cast upon drj for my possibly foolish 
views!)

--
nosy: +Dave Jones

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



[issue17124] import subprocess hangs for ~25 seconds, 700+ files in dir - py 2.7.3, & 2.6.6

2013-02-04 Thread Dave Jones

Dave Jones added the comment:

Hello Ian.
Thank you for the reply.

As I imagine you understand, I delete the "time.pyc" file every time it comes 
back.

That being said, there *is* a "time.py" script in there from some testing I was 
doing:

[jonesda0@toshiba pycode]$ ls -1tr *.py* | egrep "sp|time"
time.py
time2.py
test-sp.py
sp.py

[jonesda0@toshiba pycode]$ cat time.py
i = 0
j = 0

while (i < 1):
# i = i + 1
i+=1
# j = j + 1
j+=1

print j

--

[jonesda0@toshiba pycode]$ python sp.py
1
Done...
[jonesda0@toshiba pycode]$ ls -1tr *.py* | egrep "sp|time"
time.py
time2.py
test-sp.py
sp.py
time.pyc

--
I am not calling any sort of "time.py" anywhere:
[jonesda0@toshiba pycode]$ cat sp.py  ## still took about 25 seconds

import subprocess

print ("Done...")
--

So where does this behavior come from?

[jonesda0@toshiba pycode]$ cat time.pyc  ## There is all sorts of Escape code 
in the file, obviously.

���Pc@ss

[jonesda0@toshiba pycode]$ file time.pyc
time.pyc: python 2.7 byte-compiled
[jonesda0@toshiba pycode]$ 


-

[jonesda0@toshiba pycode]$ rm -f time.pyc
[jonesda0@toshiba pycode]$ mv time.py time.py.bad
[jonesda0@toshiba pycode]$ time python sp.py
Done...

real0m0.027s
user0m0.021s
sys 0m0.005s

[jonesda0@toshiba pycode]$ ls -1tr *.py* | egrep "sp|time"
time.py.bad
time2.py
test-sp.py
sp.py

--
Your hypothesis is clearly accurate, but my question is now *WHY*?
I was in no way calling a python time function or time.py, it just happened to 
be in the directory!

Thanks

--

___
Python tracker 
<http://bugs.python.org/issue17124>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17124] import subprocess hangs for ~25 seconds, time.py file in dir - py 2.7.3, & 2.6.6

2013-02-04 Thread Dave Jones

Dave Jones added the comment:

Tried to edit subject to make it easier to search

--
title: import subprocess hangs for ~25 seconds, 700+ files in dir - py 2.7.3, & 
2.6.6 -> import subprocess hangs for ~25 seconds, time.py file in dir - py 
2.7.3, & 2.6.6

___
Python tracker 
<http://bugs.python.org/issue17124>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17124] import subprocess hangs for ~25 seconds, 700+ files in dir - py 2.7.3, & 2.6.6

2013-02-04 Thread Dave Jones

Dave Jones added the comment:

I think I found something but I do not know what it means.
Everytime the import hangs, it seems to leave behind a "time.pyc"
There are only 29 files in this directory.

[jonesda0@linux-2py2 pycode]$ ls -1tr
py5.py*
py4.py*
py3.py*
py2.py*
py1.py*
print_func.py
test.py
ex3-4.py
time.py
time2.py
sample.py
os_test.py
params.py
changeparam.py
parity.py
remove_vowels.py
sqlite_version.py
sqlite_version_with.py
sqlite_insert.py
sqlite_insert2.py
sqlite_friends_last.py
sqlite_getall.py
dc4g2-report.rpt
out_dc4g2-report.rpt
num_guess.py
report_db_import.py*
test-sp.py
sp.py
test/
[jonesda0@linux-2py2 pycode]$ python sp.py 
1
Done...
[jonesda0@linux-2py2 pycode]$ ls -1tr
py5.py*
py4.py*
py3.py*
py2.py*
py1.py*
print_func.py
test.py
ex3-4.py
time.py
time2.py
sample.py
os_test.py
params.py
changeparam.py
parity.py
remove_vowels.py
sqlite_version.py
sqlite_version_with.py
sqlite_insert.py
sqlite_insert2.py
sqlite_friends_last.py
sqlite_getall.py
dc4g2-report.rpt
out_dc4g2-report.rpt
num_guess.py
report_db_import.py*
test-sp.py
sp.py
test/
time.pyc <<<<<<<<<<<<<<<

--

___
Python tracker 
<http://bugs.python.org/issue17124>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17124] import subprocess hangs for ~25 seconds, 700+ files in dir - py 2.7.3, & 2.6.6

2013-02-04 Thread Dave Jones

Dave Jones added the comment:

Distros tested with include Funduntu 2012-4, Fuduntu 2013-1, Fedora 17, 
Scientific Linux 6.3 & OpenSUSE 12.2 (all 32-bit) on the same hardware.

--

___
Python tracker 
<http://bugs.python.org/issue17124>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17124] import subprocess hangs for ~25 seconds, 700+ files in dir - py 2.7.3, & 2.6.6

2013-02-04 Thread Dave Jones

Dave Jones added the comment:

That line (1) seems to pop up every time the subprocess call "hangs"

--

___
Python tracker 
<http://bugs.python.org/issue17124>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17124] import subprocess hangs for ~25 seconds, 700+ files in dir - py 2.7.3, & 2.6.6

2013-02-04 Thread Dave Jones

New submission from Dave Jones:

import subprocess hangs for ~25 seconds, 700+ files in dir - py 2.7.3, & 2.6.6

I'm running this test from a LiveCD to make sure the environment is relatively 
clean.

--
localhost Desktop # python --version
Python 2.7.3
---  <<>>
localhost Desktop # cat sp.py
#!/usr/bin/python

import subprocess

print "Done..."

---
localhost Desktop # ls -1 | wc -l
7

---
localhost Desktop # time python sp.py 
Done...

real0m0.027s
user0m0.023s
sys 0m0.003s


--- BUT--- <<< This cannot be right>>>
localhost Desktop # mv sp.py  ..
mv: overwrite `../sp.py'? y
localhost Desktop # cd ..
localhost jonesda0 # cat sp.py
#!/usr/bin/python

import subprocess

print "Done..."
localhost jonesda0 # time python sp.py 
1
Done...

real0m25.336s
user0m25.270s
sys 0m0.014s
localhost jonesda0 # ls -1 | wc -l
758

Only change is the number of files in the directory.
I have tested this on several different LiveCDs but the results are the same.  
Is there some sort of flag I need to know about?

FWIW, I do not see the problem when using python3..

localhost jonesda0 # yum -y install python3
Loaded plugins: fastestmirror, langpacks, presto, refresh-packagekit
...
Installed:
  python3.i686 0:3.1.2-14.fc14  
   

Dependency Installed:
  python3-libs.i686 0:3.1.2-14.fc14 
   

Complete!
localhost jonesda0 # time python3 sp.py  ## (print function...duh)
  File "sp.py", line 5
print "Done..."
  ^
SyntaxError: invalid syntax

real0m0.048s
user0m0.044s
sys 0m0.004s
localhost jonesda0 # vi sp.py 
localhost jonesda0 # time python3 sp.py 
Done...

real0m0.091s
user0m0.084s
sys 0m0.006s

localhost jonesda0 # python3 --version
Python 3.1.2

--
messages: 181348
nosy: Dave.Jones
priority: normal
severity: normal
status: open
title: import subprocess hangs for ~25 seconds, 700+ files in dir - py 2.7.3, & 
2.6.6
versions: Python 2.6, Python 2.7

___
Python tracker 
<http://bugs.python.org/issue17124>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com