multipy -- Install multiple Python versions locally

2011-03-30 Thread Petri Lehtinen
I'm pleased to announce multipy, a shell utility that helps you
install and manage multiple local Python installations. It's available
at

https://github.com/akheron/multipy

It downloads source tarballs for the newest version of any Python X.Y,
compiles the source, and installs everything under a single directory
hierarchy. By default, the install location is ~/multipy.

distribute is also installed along with each Python version, as well
as an activate script (in the spirit of virtualenv) for easier shell
integration.

multipy is a single shell script. It requires a POSIX compliant shell,
wget, tar and gzip to download and extract source tarballs, and a
compiler, development headers and libraries to compile Python. No
existing Python installation is required. multipy should work on any
Unix-like system that Python can be compiled on.

Python versions 2.4 and up can be installed (including all 3.x
releases).


Usage examples:

Install Python 2.7 and 3.2:

$ multipy install 2.7 3.2

Install all supported Python versions (2.4 and up):

$ multipy install all

List installed Python versions:

$ multipy list

Remove Python 2.7:

$ multipy remove 2.7

Use a custom installation directory:

$ multipy -b /path/to/somewhere install 3.2

Tweak PATH to activate the local Python 2.5:

$ . $(multipy activate 2.5)

After this, e.g. python and easy_install can be used without
an absolute path. To leave this mode, use deactivate.

Regards,
Petri Lehtinen
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


Is there anyway to check the number of I/O registered in poll?

2011-03-30 Thread crow
I'm using select.poll to do I/O polling. polling is placed in a
independent thread

from select import poll
_poller = poll()

def poll(timeout):
l = _poller.poll(timeout)
return l

In my code, in some context, the timeout value will be high ( like 1
hour ), but there is no I/O in _poller, then this poll action will be
blocked till timeout.

Is there anyway to find how many I/O in _poller? Thus I can avoid
polling.

Thanks in advance.
-- 
http://mail.python.org/mailman/listinfo/python-list


Hello Friends

2011-03-30 Thread Ashraf Ali
You can fine Bollywood Actresses Biography, WAllpapers  Pictures on
the following website.
www.bollywoodhotactresses.weebly.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Hello Friends

2011-03-30 Thread Ashraf Ali
you can fine bollywood actresses biography,wallpapers  pictures on
this website
www.bollywoodhotactresses.weebly.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: multiprocessing Pool.imap broken?

2011-03-30 Thread kyle.j.con...@gmail.com
Yang,

My guess is that you are running into a problem using multiprocessing with
the interpreter. The documentation states that Pool may not work correctly
in this case.

 Note: Functionality within this package requires that the __main__ method
 be importable by the children. This is covered in *Programming 
 guidelines*http://docs.python.org/library/multiprocessing.html#multiprocessing-programminghowever
  it is worth pointing out here. This means that some examples, such
 as the multiprocessing.Pool examples will not work in the interactive
 interpreter.

Hope this helps,

Kyle



On Tue, Mar 29, 2011 at 6:51 PM, Yang Zhang yanghates...@gmail.com wrote:

 On Tue, Mar 29, 2011 at 6:44 PM, Yang Zhang yanghates...@gmail.com
 wrote:
  I've tried both the multiprocessing included in the python2.6 Ubuntu
  package (__version__ says 0.70a1) and the latest from PyPI (2.6.2.1).
  In both cases I don't know how to use imap correctly - it causes the
  entire interpreter to stop responding to ctrl-C's.  Any hints?  Thanks
  in advance.
 
  $ python
  Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
  [GCC 4.4.3] on linux2
  Type help, copyright, credits or license for more information.
  import multiprocessing as mp
  mp.Pool(1).map(abs, range(3))
  [0, 1, 2]
  list(mp.Pool(1).imap(abs, range(3)))
  ^C^C^C^C^\Quit
 

 In case anyone jumps on this, this isn't an issue with running from the
 console:

 $ cat /tmp/go3.py
 import multiprocessing as mp
 print mp.Pool(1).map(abs, range(3))
 print list(mp.Pool(1).imap(abs, range(3)))

 $ python /tmp/go3.py
 [0, 1, 2]
 ^C^C^C^C^C^\Quit

 (I've actually never seen the behavior described in the corresponding
 Note at the top of the multiprocessing documentation.)
 --
 http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Bring out yer dead Bring out yer dead

2011-03-30 Thread harrismh777


 2.6.2
 2.5.1
  ==
 (___) \--- ( 3.2 )



Cartman: Bring out yer dead,..  bring out yer dead...

Devlpr: Here' one...  (Python27)

Cartman: ... nine pence!

Python27:   I'm not dead!

Cartman: What?

Devlpr: Nothing, here's your nine pence.

Python27:   I'm not dead!

Cartman: There, he says he's not dead...

Devlpr: yes he is

Python27:   I'm not!

Cartman: He isn't?

Devlpr: Well, he will be soon, he's very ill...

Python27:   I'm getting better!

Devlpr: no yer not, you'll be stone dead in a moment...

Cartman: I can't take 'em like that, its against regulations!

Python27:   I don't want to go on the cart!

Devlpr: Oh, don't be such a baby...

Cartman: I can't take him.

Python27:   I feel fine!

Devlpr: oh, do us a favor, 'ey?

Cartman: I can't.

Devlpr: ah, can you hang around for a couple of minutes,
it won't take long?

Cartman: I've got to get to Robinson's, they've lost nine today.

Devlpr: Well, when's your next round then?

Cartman: Thursday.

Python27:   I think I'll go for a walk !

Devlpr: You're not fooling anyone ya know...(!)

Devlpr: Look, isn't there anything you can do?

Python27:   I feel happy!  I feel happy!:)

Cartman: Club( Python27 ).__whack__

Devlpr: Oh thank you very much !

Cartman: Not at all,

Devlpr: see ya Thursday?!

Cartman: Right.

Horse(virtual).__clomping__ {Guido?}

Devlpr: who's that then...

Cartman: I don't know.

Devlpr: ... must be a king!

Cartman: Why?

Devlpr: ... hasn't got shitul-over'em.


 2.7.1
 2.6.2
 2.5.1
  ==
 (___) \--- ( 3.2 )

--
http://mail.python.org/mailman/listinfo/python-list


PyInstaller and error: 'support/loader/run'

2011-03-30 Thread Ale Ghelfi
I've a script of Python 2.6.6 under Ubuntu 10.10 and i would pass it to 
XP like exe.
My script use wxPython and read some files jpg that are in the same 
directory of the script.


Before to use Pyinstaller 1.4, i did:
cd /source/linux
python Make.py
make

But make returned this error that i didn't understand:

gcc -pthread  -I/usr/include -I/usr/include/python2.6 -I../common 
-DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing 
-g -O2 -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -DHAVE_WARNINGS 
-c getpath.c -o getpath.o

getpath.c:40: fatal error: osdefs.h: File o directory non esistente
compilation terminated.
make: *** [getpath.o] Errore 1

Anyway, after this, i did also:
python Config.py

Then:
python makespec.py -F -w MioScript.py
python Build.py (il file ottenuto dal passaggio precedente)

After Build.py, pyinstaller return this error:

checking Analysis
checking PYZ
checking PKG
checking EXE
building because outEXE2.toc missing or bad
building EXE from outEXE2.toc
Traceback (most recent call last):
  File Build.py, line 1160, in module
main(args[0], configfilename=opts.configfile)
  File Build.py, line 1148, in main
build(specfile)
  File Build.py, line , in build
execfile(spec)
  File quiz/quiz.spec, line 14, in module
console=1 )
  File Build.py, line 663, in __init__
self.__postinit__()
  File Build.py, line 196, in __postinit__
self.assemble()
  File Build.py, line 748, in assemble
self.copy(exe, outf)
  File Build.py, line 764, in copy
inf = open(fnm, 'rb')
IOError: [Errno 2] No such file or directory: 'support/loader/run'

Any ideas? Thank you very very much!!

Alessandro Ghelfi
--
http://mail.python.org/mailman/listinfo/python-list


invio di una stringa

2011-03-30 Thread luca72
ciao  a tutti
sniffando i dati del protocollo irc con wireshark noto che a un certo
punto per il resume di un trasferimento un noto programma manda questa
stringa:
PRIVMSG Ex|testtrasf|001 :\001DCC RESUME prova_trasferimento.pdf 58772
5016204\001
a questo punto il server risponde.
Utilizzando i socket io riesco a connettermi al server ed a inviargli
tuti i messaggi che voglio, ma quando mando il comando sopra scritto
il server non mi risponde.
 La mia domanda è \001 a cosa corrisponde?
penso che l'inghippo sia li, perche gli altri comandi che non hanno lo
\001 vengono digeriti bene?
Grazie Luca
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Guido rethinking removal of cmp from sort method

2011-03-30 Thread Antoon Pardon
On Tue, Mar 29, 2011 at 03:35:40PM -0400, Terry Reedy wrote:
 For anyone interested, the tracker discussion on removing cmp is at
 http://bugs.python.org/issue1771
 There may have been more on the old py3k list and pydev list.
 
 One point made there is that removing cmp= made list.sort consistent
 with all the other comparision functions,
 min/max/nsmallest/nlargest/groupby that only have a key arg. How
 many would really want cmp= added everywhere?

I wouldn't have a problem with it.

I would also like to react to the following.

Guido van Rossum in msg95975 on http://bugs.python.org/issue1771 wrote:
| Also, for all of you asking for cmp back, I hope you realize that 
| sorting N values using a custom cmp function makes about N log N calls 
| calls to cmp, whereas using a custom key calls the key function only N 
| times.  This means that even if your cmp function is faster than the 
| best key function you can write, the advantage is lost as N increases 
| (which is just where you'd like it to matter most :-).

This is a play on semantics. If you need python code to compare
two items, then this code will be called N log N times, independently
of the fact how this code is presented, as a cmp function or as rich
comparison methods. So forcing people to write a key function in cases
where this will only result in the cmp code being translated to __lt__
code, accomplishes nothing. 

As far as I can see, key will only produce significant speedups, if
comparing items can then be completly done internally in the python
engine without referencing user python code.

 A minor problem problem with cmp is that the mapping between return
 values and input comparisons is somewhat arbitrary. Does -1 mean ab
 or ba? (That can be learned and memorized, of course, though I tend
 to forget without constant use).

My rule of thumb is that a  b is equivallent with cmp(a, b)  0

 A bigger problem is that it conflicts with key=. What is the result of
 l=[1,3,2]
 l.sort(cmp=lambda x,y:y-x, key=lambda x: x)
 print l
 ? (for answer, see http://bugs.python.org/issue11712 )
 
 While that can also be learned, I consider conflicting parameters
 undesireable and better avoided when reasonably possible. So I see
 this thread as a discussion of the meaning of 'reasonably' in this
 particular case.

But what does this have to do with use cases? Does what is reasonable
depend on the current use cases without regard of possible future use
cases? Is the conflict between key and cmp a lesser problem in the
case of someone having a huge data set to sort on a computer that lacks
the resources to decorate as opposed to currently noone having such
a data set? Are we going to decide which functions/methods get a cmp
argument depening on which use cases we currently have that would need it?

This thread started with a request for use cases. But if you take this
kind of things into consideration, I don't see how use cases can then
make a big difference in the final decision.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: delete namespaces

2011-03-30 Thread Jean-Michel Pichavant

monkeys paw wrote:

How do i delete a module namespace once it has been imported?

I use

import banner

Then i make a modification to banner.py. When i import it again,
the new changes are not reflected. Is there a global variable i can
modify?

It depends on what you want to achieve.

1/ if you want to re-import your module because it contains User data 
that may have been updated, one way is to make sure all you definitions 
are at the module level and use the execfile statement. ofc the file is 
executed, so it can be done only in a trusted environment.


2/ if you want to reload your module because you changed the code and 
want to test it, the best way to do it is to write a test file that will 
do all the tests so that restarting the test is cheap. Testing from a 
newly created python process is always the best solution, if available.


3/ if you want to do the 2/ but require a painful long prologue to your 
test, then you may want to use the builtin reload. Use it with care, 
because any existing object created from the previous module will not be 
affected, they'll still hold the previous code. reload solves some 
problems, but bring others, especially for the newcomer.



JM
--
http://mail.python.org/mailman/listinfo/python-list


Re: Fun python 3.2 one-liner

2011-03-30 Thread Martin De Kauwe
what is the character limit on a one liner :P. Very interesting
jesting apart, any more?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Fun python 3.2 one-liner

2011-03-30 Thread Chris Angelico
On Wed, Mar 30, 2011 at 8:19 PM, Martin De Kauwe mdeka...@gmail.com wrote:
 what is the character limit on a one liner :P. Very interesting
 jesting apart, any more?

Not sure if this can be redone as a one-liner; currently it's two.


for i in range(3):
print '\n\t'+(minor,medium,major)[i]+'
:({\n\t\t'+\n\t\t.join([q[0]+','+ .join(q[1:])+',' for q in
[q.split(\x96)[-1].split( ) for q in \n.join([q.split(
,3)[i]+ +q.split( ,3)[3] for q in
a.split(\n)]).replace(\x92,').split(\n)] if
q[0]!=\x97])+'\n\t}),'

That's the code I used in IDLE to translate this:

Minor Medium Major Ring Market Price
01–18 — — Protection +1 2,000 gp
19–28 — — Feather falling 2,200 gp
61–70 01–05 — Counterspells 4,000 gp
71–75 06–08 — Mind shielding 8,000 gp
86–90 24–28 — Ram 8,600 gp
— 29–34 — Climbing, improved 10,000 gp
— 35–40 — Jumping, improved 10,000 gp
— 41–46 — Swimming, improved 10,000 gp
91–93 47–51 — Animal friendship 10,800 gp
94–96 50–56 01–02 Energy resistance, minor 12,000 gp
99–100 62–66 — Water walking 15,000 gp
— 94–97 29–32 Blinking 27,000 gp
— 98–100 33–39 Energy resistance, major 28,000 gp
— — 40–49 Protection +4 32,000 gp
— — 98 Elemental command (fire) 200,000 gp
— — 99 Elemental command (water) 200,000 gp
— — 100 Spell storing, major 200,000 gp

into something that my dice-roller can use. (In the interests of
brevity I've chopped a whole lot of the table out, but each column
contains every possible value from 01 to 100.)

Not as cool as the previous one, but it sure was handy!

In case you're wondering: Yes, that is Dungeons and Dragons. I run an
online DD server. Nerd? Only slightly.

Chris Angelico
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [pyplot] using f1=figure(1)

2011-03-30 Thread eryksun ()
On Monday, March 28, 2011 12:04:02 PM UTC-4, Giacomo Boffi wrote:

  f1=figure(1)
  f2=figure(2)
  f1
 matplotlib.figure.Figure object at 0xb745668c
  f2
 matplotlib.figure.Figure object at 0x8df834c
  plot(sin(linspace(0,10)),figure=f1)
 [matplotlib.lines.Line2D object at 0x8df8fac]
  plot(cos(linspace(0,10)),figure=f2)
 [matplotlib.lines.Line2D object at 0x8df8f0c]
  show()

You can set the current figure to fig1 with the following:

figure(fig1.number)
plot(...)

Alternatively, you can use the plot methods of a particular axes:

fig1 = figure()
ax1 = axes()
fig2 = figure()
ax2 = axes()

ax1.plot(...)
ax2.plot(...)

It works the same for subplots:

fig1 = figure()
ax11 = subplot(211)
ax12 = subplot(212)
fig2 = figure()
ax21 = subplot(211)
ax22 = subplot(212)
 
ax12.plot(...)
#etc
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Bring out yer dead Bring out yer dead

2011-03-30 Thread bruno.desthuilli...@gmail.com
On 30 mar, 09:12, harrismh777 harrismh...@charter.net wrote:
       2.6.2
       2.5.1
    ==
       (___)     \--- ( 3.2 )

 Cartman: Bring out yer dead,..  bring out yer dead...

 Devlpr:         Here' one...  (Python27)

 Cartman: ... nine pence!

 Python27:               I'm not dead!

 Cartman: What?

 Devlpr: Nothing, here's your nine pence.

 Python27:               I'm not dead!

 Cartman: There, he says he's not dead...

 Devlpr: yes he is

 Python27:               I'm not!

 Cartman: He isn't?

 Devlpr: Well, he will be soon, he's very ill...

 Python27:               I'm getting better!

 Devlpr: no yer not, you'll be stone dead in a moment...

 Cartman: I can't take 'em like that, its against regulations!

 Python27:               I don't want to go on the cart!

 Devlpr: Oh, don't be such a baby...

 Cartman: I can't take him.

 Python27:               I feel fine!

 Devlpr: oh, do us a favor, 'ey?

 Cartman: I can't.

 Devlpr: ah, can you hang around for a couple of minutes,
         it won't take long?

 Cartman: I've got to get to Robinson's, they've lost nine today.

 Devlpr: Well, when's your next round then?

 Cartman: Thursday.

 Python27:               I think I'll go for a walk !

 Devlpr: You're not fooling anyone ya know...(!)

 Devlpr: Look, isn't there anything you can do?

 Python27:               I feel happy!  I feel happy!    :)

 Cartman: Club( Python27 ).__whack__

 Devlpr: Oh thank you very much !

 Cartman: Not at all,

 Devlpr: see ya Thursday?!

 Cartman: Right.

         Horse(virtual).__clomping__     {Guido?}

 Devlpr: who's that then...

 Cartman: I don't know.

 Devlpr: ... must be a king!

 Cartman: Why?

 Devlpr: ... hasn't got shitul-over'em.

       2.7.1
       2.6.2
       2.5.1
    ==
       (___)     \--- ( 3.2 )


+1 QOTW - but this will make for the longuest QOTW ever g
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Directly Executable Files in Python

2011-03-30 Thread eryksun ()
On Tuesday, March 29, 2011 3:51:30 AM UTC-4, Paul Rudin wrote:
 Benjamin Kaplan benjami...@case.edu writes:
 
  If you can figure out a good way to compile a language like Python,
  you'll be very rich. Yes, it is running the interpreter and then
  running the bytecode on the interpreter. It's the same way Java and
  .NET work.
 
 Not exactly AIUI. .NET bytecodes do actually get compiled to executable code
 before being executed (unless things have changed recently - I haven't
 really done anything significant with .NET in the last couple of years).

Java and languages in Microsoft's CLI (common language infrastructure) are 
statically typed, so it's not exactly a straight-forward comparison. 

IIRC, IronPython programs compile to a DLR (dynamic language runtime) AST 
(abstract source tree). This represents the program as runtime method calls and 
invoked DynamicSite objects. A site creates a caching delegate that checks the 
given argument types. As it encounters new combinations of argument types, it 
compiles the operation and updates the delegate.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: multiprocessing Pool.imap broken?

2011-03-30 Thread eryksun ()
On Tuesday, March 29, 2011 9:44:21 PM UTC-4, Yang Zhang wrote:
 I've tried both the multiprocessing included in the python2.6 Ubuntu
 package (__version__ says 0.70a1) and the latest from PyPI (2.6.2.1).
 In both cases I don't know how to use imap correctly - it causes the
 entire interpreter to stop responding to ctrl-C's.  Any hints?  Thanks
 in advance.
 
 $ python
 Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
 [GCC 4.4.3] on linux2
 Type help, copyright, credits or license for more information.
  import multiprocessing as mp
  mp.Pool(1).map(abs, range(3))
 [0, 1, 2]
  list(mp.Pool(1).imap(abs, range(3)))
 ^C^C^C^C^\Quit

It works fine for me on Win32 Python 2.7.1 with multiprocessing 0.70a1. So it's 
probably an issue with the implementation on Linux.

Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) 
[MSC v.1500 32 bit (Intel)] on win32
Type help, copyright, credits or license for more information.
 import multiprocessing as mp
 list(mp.Pool(1).imap(abs, range(3)))
[0, 1, 2]
 mp.__version__
'0.70a1'
-- 
http://mail.python.org/mailman/listinfo/python-list


learn python the hard way exercise 42 help

2011-03-30 Thread neil harper
http://pastie.org/1735028
hey guys play is confusing me, i get how next gets the first room, which
is passed when the instance of Game() is created, but how does it get
the next room?

thanks

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: learn python the hard way exercise 42 help

2011-03-30 Thread eryksun ()
On Wednesday, March 30, 2011 9:48:29 AM UTC-4, neil harper wrote:
 http://pastie.org/1735028
 hey guys play is confusing me, i get how next gets the first room, which
 is passed when the instance of Game() is created, but how does it get
 the next room?
 
 thanks

Each room is a method of Game. The returned value of each room is a reference 
to another room, depending on some condition. play() just loops the following: 
call room(); store the return reference as next; assign next to room. This 
continues until death(), which randomly insults you and quits.
-- 
http://mail.python.org/mailman/listinfo/python-list


Sudden error: SyntaxError: Non-ASCII character '\xc2' in file

2011-03-30 Thread Gnarlodious
RSS script runs fine on my dev machine but errors on the server
machine. Script was last run 3 days ago with no problem. Possible
clue: dev machine is (Mac OSX) running Python 3.1.1 while server is
running Python 3.1.3. I have not updated anything that should suddenly
cause this error starting yesterday.

The error originates at '·' which string contains a middot;
character.

Complete error message is:

SyntaxError: Non-ASCII character '\xc2' in file /Library/WebServer/
Sites/Sectrum/Site/Feed.py on line 17, but no encoding declared; see
http://www.python.org/peps/pep-0263.html for details

Any help how to fix this and why it suddenly started erroring 2 days
ago...

-- Gnarlie
-- 
http://mail.python.org/mailman/listinfo/python-list


logging module usage

2011-03-30 Thread mennis
I am working on a library for controlling various appliances in which
I use the logging module.  I'd like some input on the basic structure
of what I've done.  Specifically the logging aspect but more general
comments are welcome.  I'm convinced I mis-understand something but
I'm not sure what.  I've posted a version of the library at github.

g...@github.com:mennis/otto.git
http://github.com/mennis/otto
Ian
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sudden error: SyntaxError: Non-ASCII character '\xc2' in file

2011-03-30 Thread Benjamin Kaplan
On Wed, Mar 30, 2011 at 10:34 AM, Gnarlodious gnarlodi...@gmail.com wrote:
 RSS script runs fine on my dev machine but errors on the server
 machine. Script was last run 3 days ago with no problem. Possible
 clue: dev machine is (Mac OSX) running Python 3.1.1 while server is
 running Python 3.1.3. I have not updated anything that should suddenly
 cause this error starting yesterday.

 The error originates at '·' which string contains a middot;
 character.

 Complete error message is:

 SyntaxError: Non-ASCII character '\xc2' in file /Library/WebServer/
 Sites/Sectrum/Site/Feed.py on line 17, but no encoding declared; see
 http://www.python.org/peps/pep-0263.html for details

 Any help how to fix this and why it suddenly started erroring 2 days
 ago...

 -- Gnarlie

You don't have a middot character. Your computer doesn't understand
characters. You have the byte sequence \xc2\xb7. When you have a
Unicode string (the default in Python 3), Python needs some way of
converting the byte sequence to a character sequence. The way it does
that is through the encoding. But you don't have an encoding
specified, so rather than guess, Python is falling back on the lowest
common denominator: ASCII, which doesn't understand the byte \xc2-
hence the error.

To fix this, just put the line
# coding=utf-8
at the very top of the code file.

 --
 http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sudden error: SyntaxError: Non-ASCII character '\xc2' in file

2011-03-30 Thread Peter Otten
Gnarlodious wrote:

 RSS script runs fine on my dev machine but errors on the server
 machine. Script was last run 3 days ago with no problem. Possible
 clue: dev machine is (Mac OSX) running Python 3.1.1 while server is
 running Python 3.1.3. I have not updated anything that should suddenly
 cause this error starting yesterday.
 
 The error originates at '·' which string contains a middot;
 character.
 
 Complete error message is:
 
 SyntaxError: Non-ASCII character '\xc2' in file /Library/WebServer/
 Sites/Sectrum/Site/Feed.py on line 17, but no encoding declared; see
 http://www.python.org/peps/pep-0263.html for details
 
 Any help how to fix this and why it suddenly started erroring 2 days
 ago...

You are trying to run your 3.x code with Python 2.x...

-- 
http://mail.python.org/mailman/listinfo/python-list


argparse csv + choices

2011-03-30 Thread Neal Becker
I'm trying to combine 'choices' with a comma-seperated list of options, so I 
could do e.g., 

--cheat=a,b

parser.add_argument ('--cheat', choices=('a','b','c'), type=lambda x: 
x.split(','), default=[])

test.py --cheat a
 error: argument --cheat: invalid choice: ['a'] (choose from 'a', 'b', 'c')

The validation of choice is failing, because parse returns a list, not an item. 
 
Suggestions?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sudden error: SyntaxError: Non-ASCII character '\xc2' in file

2011-03-30 Thread Peter Otten
Benjamin Kaplan wrote:

 On Wed, Mar 30, 2011 at 10:34 AM, Gnarlodious gnarlodi...@gmail.com
 wrote:
 RSS script runs fine on my dev machine but errors on the server
 machine. Script was last run 3 days ago with no problem. Possible
 clue: dev machine is (Mac OSX) running Python 3.1.1 while server is
 running Python 3.1.3. I have not updated anything that should suddenly
 cause this error starting yesterday.

 The error originates at '·' which string contains a middot;
 character.

 Complete error message is:

 SyntaxError: Non-ASCII character '\xc2' in file /Library/WebServer/
 Sites/Sectrum/Site/Feed.py on line 17, but no encoding declared; see
 http://www.python.org/peps/pep-0263.html for details

 Any help how to fix this and why it suddenly started erroring 2 days
 ago...

 -- Gnarlie
 
 You don't have a middot character. Your computer doesn't understand
 characters. You have the byte sequence \xc2\xb7. When you have a
 Unicode string (the default in Python 3), Python needs some way of
 converting the byte sequence to a character sequence. The way it does
 that is through the encoding. But you don't have an encoding
 specified, so rather than guess, Python is falling back on the lowest
 common denominator: ASCII, which doesn't understand the byte \xc2-
 hence the error.
 
 To fix this, just put the line
 # coding=utf-8
 at the very top of the code file.

All good advice except that Python 3 defaults to UTF-8 not ASCII as its 
source encoding.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: argparse csv + choices

2011-03-30 Thread Robert Kern

On 3/30/11 10:32 AM, Neal Becker wrote:

I'm trying to combine 'choices' with a comma-seperated list of options, so I
could do e.g.,

--cheat=a,b

 parser.add_argument ('--cheat', choices=('a','b','c'), type=lambda x:
x.split(','), default=[])

test.py --cheat a
  error: argument --cheat: invalid choice: ['a'] (choose from 'a', 'b', 'c')

The validation of choice is failing, because parse returns a list, not an item.
Suggestions?


Do the validation in the type function.


import argparse

class ChoiceList(object):
def __init__(self, choices):
self.choices = choices

def __repr__(self):
return '%s(%r)' % (type(self).__name__, self.choices)

def __call__(self, csv):
args = csv.split(',')
remainder = sorted(set(args) - set(self.choices))
if remainder:
raise ValueError(invalid choices: %r (choose from %r) % 
(remainder, self.choices))

return args


parser = argparse.ArgumentParser()
parser.add_argument('--cheat', type=ChoiceList(['a','b','c']), default=[])
print parser.parse_args(['--cheat=a,b'])
parser.parse_args(['--cheat=a,b,d'])

--
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco

--
http://mail.python.org/mailman/listinfo/python-list


Re: Sudden error: SyntaxError: Non-ASCII character '\xc2' in file

2011-03-30 Thread eryksun ()
On Wednesday, March 30, 2011 10:34:46 AM UTC-4, Gnarlodious wrote:
 
 The error originates at '·' which string contains a middot;
 character.
 
 Complete error message is:
 
 SyntaxError: Non-ASCII character '\xc2' in file /Library/WebServer/
 Sites/Sectrum/Site/Feed.py on line 17, but no encoding declared; see
 http://www.python.org/peps/pep-0263.html for details

A middle dot is Unicode \x00\xb7, which maps to UTF-8 \xc2\xb7. According to 
PEP 3120 the default source encoding for Python 3.x is UTF-8. (I'll take their 
word for it, since I'm still using 2.7). Are you declaring an ASCII encoding 
(e.g. # coding: ascii)? If not, are you sure that you're running in 3.x?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: delete namespaces

2011-03-30 Thread Terry Reedy

On 3/30/2011 5:10 AM, Jean-Michel Pichavant wrote:


3/ if you want to do the 2/ but require a painful long prologue to your
test, then you may want to use the builtin reload. Use it with care,
because any existing object created from the previous module will not be
affected, they'll still hold the previous code. reload solves some
problems, but bring others, especially for the newcomer.


Guido removed it in 3.x because it is badly flawed and he could see any 
way to sensibly fix it.


--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


Get USB ID of a serial port through pyserial?

2011-03-30 Thread John Nagle

  Is there some way to get the USB ID of a serial port through
pyserial on Linux and/or Windows?  USB serial port devices have
device names determined by when they were plugged in.  So, if
you have more than one USB serial device, you need the USB device's
built-in ID to figure out what's out there.

  Is there a way to get that info portably?

John Nagle
--
http://mail.python.org/mailman/listinfo/python-list


Re: delete namespaces

2011-03-30 Thread Tim Golden

On 30/03/2011 8:03 PM, Terry Reedy wrote:

On 3/30/2011 5:10 AM, Jean-Michel Pichavant wrote:


3/ if you want to do the 2/ but require a painful long prologue to your
test, then you may want to use the builtin reload. Use it with care,
because any existing object created from the previous module will not be
affected, they'll still hold the previous code. reload solves some
problems, but bring others, especially for the newcomer.


Guido removed it in 3.x because it is badly flawed and he could see any
way to sensibly fix it.


Well, moved rather than removed:

dump
Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52)
Type help, copyright, credits or license

import imp
imp.reload

built-in function reload




/dump

TJG
--
http://mail.python.org/mailman/listinfo/python-list


Re: Data files for tests

2011-03-30 Thread Ethan Furman

Steven D'Aprano wrote:
I have a package with some tests. The tests are not part of the package 


Do you mean they are not importable, as in

-- from spam import tests

or they are not distributed?  Because it seems to me that distributing 
them would be worthwhile to at least some of the folks downloading your 
package (assuming you distribute it).


For myself, I do keep my tests in a folder in the package itself -- 
keeps it out of the way (any necessary files also go there).


~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list


py 2.7.1 openssl

2011-03-30 Thread V N
I installed openssl-1.0.0d.tar.gz on my RHEL 5 box using:
 ./config --prefix=/usr/local --openssldir=/usr/local/openssl
shared zlib
 make
 sudo make install

Then I installed python 2.7.1 using
 PYHOME=/usr/local/Python-2.7.1; export PYHOME
 LD_RUN_PATH=$PYHOME/lib; export LD_RUN_PATH
 LDFLAGS=-L /usr/local/lib64 -L /usr/local/lib; export
LDFLAGS
 CPPFLAGS=-I /usr/local/include -I /usr/local/include/
openssl; export CPPFLAGS
 ./configure --enable-shared --prefix=$PYHOME  log_cfg 21
 make  log_mk 21
 sudo make install  log_mk_i 21

I am trying to install
sudo $PYHOME/bin/python bin/ez_setup.py

and I get the following error:

Traceback (most recent call last):
  File bin/ez_setup.py, line 67, in module
except ImportError: from md5 import md5
  File /usr/local/Python-2.7.1/lib/python2.7/md5.py, line 10, in
module
from hashlib import md5
  File /usr/local/Python-2.7.1/lib/python2.7/hashlib.py, line 136,
in module
globals()[__func_name] = __get_hash(__func_name)
  File /usr/local/Python-2.7.1/lib/python2.7/hashlib.py, line 71, in
__get_builtin_constructor
import _md5
ImportError: No module named _md5

-- 
http://mail.python.org/mailman/listinfo/python-list


FBI wants public help solving encrypted notes from murder mystery

2011-03-30 Thread Joe Snodgrass

FBI cryptanalysis hasn’t decrypted notes from 1999 murder mystery

http://tinyurl.com/4d56zsz

The FBI is seeking the public's help in breaking the encrypted code
found in two notes discovered on the body of a murdered man in 1999.

The FBI says that officers in St. Louis, Missouri discovered the body
of 41-year-old Ricky McCormick on June 30, 1999 in a field and the
clues regarding the homicide were two encrypted notes found in the
victim's pants pockets.

The FBI says that despite extensive work by its Cryptanalysis and
Racketeering Records Unit (CRRU), and the American Cryptogram
Association, the meanings of those two coded notes remain a mystery
and McCormick's murderer has never been found. One has to wonder
though, if the FBI can't figure this out, who can? But I digress.

From the FBI: The more than 30 lines of coded material use a
maddening variety of letters, numbers, dashes, and parentheses.
McCormick was a high school dropout, but he was able to read and write
and was said to be 'street smart.' According to members of his family,
McCormick had used such encrypted notes since he was a boy, but
apparently no one in his family knows how to decipher the codes, and
it's unknown whether anyone besides McCormick could translate his
secret language. Investigators believe the notes in McCormick's
pockets were written up to three days before his death.

Standard routes of cryptanalysis seem to have hit brick walls, said
CRRU chief Dan Olson in a statement. To move the case forward,
examiners need another sample of McCormick's coded system-or a similar
one-that might offer context to the mystery notes or allow valuable
comparisons to be made. Or, short of new evidence, Olson said, Maybe
someone with a fresh set of eyes might come up with a brilliant new
idea.

The FBI says it has always relied on public tips and other assistance
to solve crimes though breaking a code may represent a special
circumstance.

For larger images of the notes go here. [LINK]

If you have an idea how to break the code, have seen similar codes, or
have any information about the Ricky McCormick case, write to CRRU at
the following address:

FBI Laboratory
Cryptanalysis and Racketeering Records Unit
2501 Investigation Parkway
Quantico, VA 22135
Attn: Ricky McCormick Case

There is no reward being offered, just the knowledge that you may be
solving an intriguing murder mystery, the FBI stated.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: FBI wants public help solving encrypted notes from murder mystery

2011-03-30 Thread Fons Adriaensen
On Wed, Mar 30, 2011 at 01:25:54PM -0700, Joe Snodgrass wrote:

 For larger images of the notes go here. [LINK]

[LINK]  ???

-- 
FA


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: FBI wants public help solving encrypted notes from murder mystery

2011-03-30 Thread harrismh777

Fons Adriaensen wrote:

[LINK]  ???


http://www.net-security.org/secworld.php?id=10823


--
http://mail.python.org/mailman/listinfo/python-list


Next Melbourne PUG meeting 6pm Monday 4th of April @ RMIT

2011-03-30 Thread Richard Jones
Hi all,

Sorry for the late post this week. The next meeting is next Monday,
the 4th of April at RMIT.

The room has changed! After the double-booking last week we've been
moved to 12.07.02 (building 12, level 7, room 2).

Tennessee's going to talk to us about an approach to benchmarking that
he's been working on.

If you have some experience with benchmarking or profiling Python
code, perhaps you have something you can share?

I'm going to talk about PyWeek number 12, which starts this coming
Sunday morning :-)

Full meeting info at http://j.mp/mpug


 Richard
-- 
http://mail.python.org/mailman/listinfo/python-list


Dictionary Descriptors

2011-03-30 Thread Raymond Hettinger
On the python-ideas list, someone made a wild proposal to add
descriptors to dictionaries.

None of the respondents seemed to realize that you could (not should,
just could) already implement this using hooks already present in the
language.  I'm posting an example here because I thought you all might
find it to be both interesting and educational.

For more details on how it works and how it relates to descriptors,
see http://mail.python.org/pipermail/python-ideas/2011-March/009657.html

Raymond

 sample code 

class MyDict(object):
def __init__(self, mapping):
self.mapping = mapping
def __getitem__(self, key):
value = self.mapping[key]
if hasattr(value, '__get__'):
print('Invoking descriptor on', key)
return value.__get__(key)
print('Getting', key)
return value
def __setitem__(self, key, value):
self.mapping[key] = value

class Property:
def __init__(self, getter):
self.getter = getter
def __get__(self, key):
return self.getter(key)

if __name__ == '__main__':
md = MyDict({})
md['x'] = 10
md['_y'] = 20
md['y'] = Property(lambda key: md['_'+key])
print(eval('x+y+1', {}, md))

 output 

Getting x
Invoking descriptor on y
Getting _y
31
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Fun python 3.2 one-liner

2011-03-30 Thread Raymond Hettinger
On Mar 30, 2:19 am, Martin De Kauwe mdeka...@gmail.com wrote:
 what is the character limit on a one liner :P. Very interesting
 jesting apart, any more?

Sure, here are three one-liners using itertools.groupby() to emulate
some Unix pipelines:

  sort letters | uniq   # list unique values
  sort letters | uniq -c# count unique values
  sort letters | uniq -d# find duplicates

 from itertools import groupby

 [k for k, g in groupby(sorted('abracadabra'))]
['a', 'b', 'c', 'd', 'r']

 [(k, len(list(g))) for k, g in groupby(sorted('abracadabra'))]
[('a', 5), ('b', 2), ('c', 1), ('d', 1), ('r', 2)]

 [k for k, g in groupby(sorted('abracadabra')) if len(list(g))  1]
['a', 'b', 'r']


Raymond


P.S.  Of course, there are many ways to do this.

 sorted(set('abracadabra'))
['a', 'b', 'c', 'd', 'r']

 sorted(Counter('abracadabra').items())
[('a', 5), ('b', 2), ('c', 1), ('d', 1), ('r', 2)]

 sorted(k for k,c in Counter('abracadabra').items() if c  1)
['a', 'b', 'r']
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: learn python the hard way exercise 42 help

2011-03-30 Thread Raymond Hettinger
On Mar 30, 6:48 am, neil harper neilalt300...@gmail.com wrote:
 http://pastie.org/1735028
 hey guys play is confusing me, i get how next gets the first room, which
 is passed when the instance of Game() is created, but how does it get
 the next room?

It might help show calling patterns if you added print statements to
the while loop:

   def play(self):
next = self.start
while True:
room = getattr(self, next)
print --- Calling the method:, room, ---
next = room()
print --- That method returned:, next, ---

Raymond
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: popular programs made in python?

2011-03-30 Thread Raymond Hettinger
On Mar 29, 7:32 am, Neil Alt neilalt300...@gmail.com wrote:
 i mean made with python only, not just a small part of python.

BitTorrent was a huge success.


Raymond
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sudden error: SyntaxError: Non-ASCII character '\xc2' in file

2011-03-30 Thread Gnarlodious
On Mar 30, 9:28 am, Peter Otten wrote:

 You are trying to run your 3.x code with Python 2.x...

You're right. Exactly why this started happening I don't know.

Thanks.

-- Gnarlie
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: delete namespaces

2011-03-30 Thread Raymond Hettinger
[monkeys paw]
  How do i delete a module namespace once it has been imported?
 . . .
  Then i make a modification to banner.py. When i import it again,
  the new changes are not reflected.

[Terry Reedy]
 The best thing, if possible, is to restart the program.
 If you develop banner.py with adequate tests, you will want to restart
 the test anyway, and you should not need to modify much thereafter.

This is excellent advice.

You're much better-off starting fresh each time.


Raymond

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Directly Executable Files in Python

2011-03-30 Thread Raymond Hettinger
On Mar 28, 8:37 pm, Jordan Meyer jordanmeyer1...@gmail.com wrote:
 Is it possible to make a directly executable (such as .exe on Windows) file 
 from scripts written in Python? So as to prevent the end-user from having to 
 download an interpreter to run the program.

http://docs.python.org/faq/programming.html#how-can-i-create-a-stand-alone-binary-from-a-python-script


Raymond
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why aren't copy and deepcopy in __builtins__?

2011-03-30 Thread Raymond Hettinger
On Mar 27, 8:29 pm, John Ladasky lada...@my-deja.com wrote:
 Simple question.  I use these functions much more frequently than many
 others which are included in __builtins__.  I don't know if my
 programming needs are atypical, but my experience has led me to wonder
 why I have to import these functions.

I asked Guido about this once and he said that he didn't
consider them to be part of the core.  He worried that
they would be overused by beginners and they would be
a distraction from learning plain, simple Python which
doesn't often need either copy() or deepcopy().

AFAICT, he was right.  I've seen large projects where
deepcopy and copy where not used even once.

Raymond
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: best python games?

2011-03-30 Thread Raymond Hettinger
On Mar 25, 7:39 pm, sogeking99 neilalt300...@gmail.com wrote:
 hey guys, what are some of the best games made in python? free games
 really. like pygames stuff. i want to see what python is capable of.

 cant see any good one on pygames site really, though they have nothing
 like sort by rating or most downloaded as far as i can tell

At Pycon, I saw some impressive looking games written
during the PyWeek, Python Game Programming Challenge
http://www.pyweek.org/

I think they're fine examples of what Python is capable of.


Raymond
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: popular programs made in python?

2011-03-30 Thread eryksun ()
On Tuesday, March 29, 2011 10:32:26 AM UTC-4, Neil Alt wrote:
 i mean made with python only, not just a small part of python.

I think it's uncommon for an application to be programmed entirely in Python. 
It's common to use C/C++ to accelerate performance critical parts of the code. 
I don't see that as a weakness of Python. The developer uses whichever tools 
work best for the task at hand.

Calibre is a popular e-book manager/converter created by Kovid Goyal. It's 
mostly written in Python, with some C extensions for speedups (e.g. SQLite 
database access) and interfacing to OS APIs for fonts, USB devices, etc:

http://bazaar.launchpad.net/~kovid/calibre/trunk/files


-- 
http://mail.python.org/mailman/listinfo/python-list


running Python2 Python3 parallel concurrent

2011-03-30 Thread harrismh777

Greetings,

The purpose of this communique is to document a process for 
installing python2.7.1 in parallel with python3.2 on a concurrent 
desktop with independent idle and python path structure.


Each version (python2, python3) will be installed in a separate 
python shell (idle) run on a separate local install so that both 
versions are running side-by-side on the same user desktop, each python 
shell having a unique .idlerc(v) configuration dir for lookfeel as well 
as separate recent files lists and separate working .py folders.


Neither of the installs should affect the other installation (nor 
idle operation), nor should the installs affect the system-wide default 
install (python2.6.2 in my case running ubuntu 9.04 jaunty). As well, 
the search paths should not overlap except at the top $HOME level. The 
over-all purpose is to be able to play with both versions together in 
order to facilitate/enable/solve concurrent development, migration, and 
debug issues between the two versions.


I trust that if the community has already solved this problem, and 
has a better way, that I may discover it and be able to adopt it to my 
own environment as well.


If you find any mistakes, please let me know.

Best regards, m harris.

The primary unordered issues for solution(s) are:

1) separate PythonX folders for .py files, $HOME/PythonX
2) separate desktop launchers to cleanly launch idleX for pythonX
3) separate .idlercX files in the home dir for IDLE pythonX
4) separate correct $HOME/local/pythonX installation folders
5) separate correct $HOME/bin/ launch scripts and sym links
6) Config from sources with correct --prefix setting
7) Local Build  Install

===
BUILD VERSIONS FROM SOURCE
===
Download the 2.7.1 and 3.2 tarballs from here:

http://www.python.org/download/

From your $HOME directory create the modules (.py) folder with:

mkdir Python3 ie.,  $HOME/Python3/

 and then create the local installation folder in $HOME/local:

mkdir local
cd local
mkdir python3 ie.,  $HOME/local/python3/

Create a $HOME/bin/ folder, if it does not already exist.

Unpack each tarball in $HOME with:

tar -xvf Python-3.2.tar.bz2 --bzip2

cd Python-3.2and then build  install with:

./configure --prefix=$HOME/local/python3
make
make install

NOTES:  Repeat these steps for each local version. It is important 
that the development headers already be installed, including the tk-dev 
package so that tkinter mod will get built enabling idle. The tarballs 
are available in several compression schemes... I chose bzip2.
The --prefix option tells the installer where pythonX will live; 
this will be a local install visible only to the development user.


===
Symbolic link(s)
===

Create a symbolic link for python in $HOME/bin/ with:

cd $HOME/bin/
ln -sf $HOME/local/python3/bin/python3 python3

note:  (python3 can now be invoked from a linux terminal)

   Repeat the steps for each version.

   You may need to set your linux path to include
   $HOME/bin/  in either .profile or .bashrc if not
   already in place. This is usually already set on
   most modern linux distros if ~/bin/ exists.

===
Launcher Scripts
===

Create the bash launcher script used for setting the
PYTHONPATH and starting the python3 script. Use a text
editor of your choice to create a text file in $HOME/bin/
called  Python3-IDE  containing these three lines:

#!/bin/sh
export PYTHONPATH=$HOME/Python3
exec $HOME/bin/idle-python3 -n

Now, create the python script for importing and launching
the PyShell from idlelib; use a text editor to create a
text file in $HOME/bin/ called  idle-python3  containing:

#!/home/username/bin/python3

from idlelib.PyShell import main
if __name__ == '__main__':
main()

The first line /home/username/ is $HOME, but may have to
be spelled out in the script above. Now, set both scripts
executeable with:

chmod 0754 $HOME/bin/Python3-IDE
chmod 0754 $HOME/bin/idle-python3

Notes:  Repeat for each version. Summary; each version will
have its own launcher script ( PythonX-IDE ) and each will
have its own python idle starter script ( idle-pythonX ).

The launcher script is the 'called' file from the Desktop
launcher icon, which sets the PYTHONPATH. The python idle
starter script correctly starts the interpreter and then
initiates the PyShell (python idle shell) import main and

Re: FBI wants public help solving encrypted notes from murder mystery

2011-03-30 Thread David Bernier

Joe Snodgrass wrote:


FBI cryptanalysis hasn’t decrypted notes from 1999 murder mystery

http://tinyurl.com/4d56zsz

The FBI is seeking the public's help in breaking the encrypted code
found in two notes discovered on the body of a murdered man in 1999.

The FBI says that officers in St. Louis, Missouri discovered the body
of 41-year-old Ricky McCormick on June 30, 1999 in a field and the
clues regarding the homicide were two encrypted notes found in the
victim's pants pockets.

The FBI says that despite extensive work by its Cryptanalysis and
Racketeering Records Unit (CRRU), and the American Cryptogram
Association, the meanings of those two coded notes remain a mystery
and McCormick's murderer has never been found. One has to wonder
though, if the FBI can't figure this out, who can? But I digress.

 From the FBI: The more than 30 lines of coded material use a
maddening variety of letters, numbers, dashes, and parentheses.
McCormick was a high school dropout, but he was able to read and write
and was said to be 'street smart.' According to members of his family,
McCormick had used such encrypted notes since he was a boy, but
apparently no one in his family knows how to decipher the codes, and
it's unknown whether anyone besides McCormick could translate his
secret language. Investigators believe the notes in McCormick's
pockets were written up to three days before his death.

Standard routes of cryptanalysis seem to have hit brick walls, said
CRRU chief Dan Olson in a statement. To move the case forward,
examiners need another sample of McCormick's coded system-or a similar
one-that might offer context to the mystery notes or allow valuable
comparisons to be made. Or, short of new evidence, Olson said, Maybe
someone with a fresh set of eyes might come up with a brilliant new
idea.

The FBI says it has always relied on public tips and other assistance
to solve crimes though breaking a code may represent a special
circumstance.

[...]

There are two JPG images (note1.jpg and note2.jpg) at the web page:

 http://www.fbi.gov/news/stories/2011/march  .

As they say there:
 View larger versions (right click and save the files to enlarge further).
i.e. :
Right click on first image and Save image as ... using the browser,
on second image and Save image as ... using the browser.

I used the GIMP (GNU Image Manipulation Program) to
enlarge and otherwise manipulate the images.  But each
is only about 50 to 80 kilobytes ...

--
http://mail.python.org/mailman/listinfo/python-list


Re: FBI wants public help solving encrypted notes from murder mystery

2011-03-30 Thread Stretto



Joe Snodgrass joe.s...@yahoo.com wrote in message 
news:c37e8e0b-a825-4ac5-9886-8828ab1fa...@x8g2000prh.googlegroups.com...


FBI cryptanalysis hasn’t decrypted notes from 1999 murder mystery

http://tinyurl.com/4d56zsz

The FBI is seeking the public's help in breaking the encrypted code
found in two notes discovered on the body of a murdered man in 1999.

The FBI says that officers in St. Louis, Missouri discovered the body
of 41-year-old Ricky McCormick on June 30, 1999 in a field and the
clues regarding the homicide were two encrypted notes found in the
victim's pants pockets.

The FBI says that despite extensive work by its Cryptanalysis and
Racketeering Records Unit (CRRU), and the American Cryptogram
Association, the meanings of those two coded notes remain a mystery
and McCormick's murderer has never been found. One has to wonder
though, if the FBI can't figure this out, who can? But I digress.

From the FBI: The more than 30 lines of coded material use a
maddening variety of letters, numbers, dashes, and parentheses.
McCormick was a high school dropout, but he was able to read and write
and was said to be 'street smart.' According to members of his family,
McCormick had used such encrypted notes since he was a boy, but
apparently no one in his family knows how to decipher the codes, and
it's unknown whether anyone besides McCormick could translate his
secret language. Investigators believe the notes in McCormick's
pockets were written up to three days before his death.

Standard routes of cryptanalysis seem to have hit brick walls, said
CRRU chief Dan Olson in a statement. To move the case forward,
examiners need another sample of McCormick's coded system-or a similar
one-that might offer context to the mystery notes or allow valuable
comparisons to be made. Or, short of new evidence, Olson said, Maybe
someone with a fresh set of eyes might come up with a brilliant new
idea.

The FBI says it has always relied on public tips and other assistance
to solve crimes though breaking a code may represent a special
circumstance.

For larger images of the notes go here. [LINK]

If you have an idea how to break the code, have seen similar codes, or
have any information about the Ricky McCormick case, write to CRRU at
the following address:

FBI Laboratory
Cryptanalysis and Racketeering Records Unit
2501 Investigation Parkway
Quantico, VA 22135
Attn: Ricky McCormick Case

There is no reward being offered, just the knowledge that you may be
solving an intriguing murder mystery, the FBI stated.


No other information about the guy? It might help. If the note is of any use 
then people and places would be in it. If that is the case then it would 
help to know where he lived and some of the names of people he knows.


The note seems like it may not be just encrypted but a sort of 
compression(or rather shorthand/jargon) was used. Was the guy a drug dealer? 
It could be a list of clients or information about where he sold drugs(the 
numbers look like street addresses or amounts.


If these kinda notes were so common from this guy then surely the FBI should 
have many more?


Seems like the FBI could do more if they wanted it really solved... 


--
http://mail.python.org/mailman/listinfo/python-list


Re: Guido rethinking removal of cmp from sort method

2011-03-30 Thread Steven D'Aprano
On Wed, 30 Mar 2011 11:06:20 +0200, Antoon Pardon wrote:

 As far as I can see, key will only produce significant speedups, if
 comparing items can then be completly done internally in the python
 engine without referencing user python code.

Incorrect. You don't even need megabytes of data to see significant 
differences. How about a mere 1000 short strings?


[steve@wow-wow ~]$ python2.6
Python 2.6.6 (r266:84292, Dec 21 2010, 18:12:50)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2
Type help, copyright, credits or license for more information.
 from random import shuffle
 data = ['a'*n for n in range(1000)]
 shuffle(data)
 from timeit import Timer

 t_key = Timer('sorted(data, key=lambda a: len(a))',
... 'from __main__ import data')
 t_cmp = Timer('sorted(data, cmp=lambda a,b: cmp(len(a), len(b)))',
... 'from __main__ import data')

 min(t_key.repeat(number=1000, repeat=5))
0.89357517051696777
 min(t_cmp.repeat(number=1000, repeat=5))
7.6032949066162109


That's almost ten times slower.

Of course, the right way to do that specific sort is:

 t_len = Timer('sorted(data, key=len)', 'from __main__ import data')
 min(t_len.repeat(number=1000, repeat=5))
0.64559602737426758

which is even easier and faster. But even comparing a pure Python key 
function to the cmp function, it's obvious that cmp is nearly always 
slower.

Frankly, trying to argue that cmp is faster, or nearly as fast, is a 
losing proposition. In my opinion, the only strategy that has even a 
faint glimmer of hope is to find a convincing use-case where speed does 
not matter.

Or, an alternative approach would be for one of the cmp-supporters to 
take the code for Python's sort routine, and implement your own sort-with-
cmp (in C, of course, a pure Python solution will likely be unusable) and 
offer it as a download. For anyone who knows how to do C extensions, this 
shouldn't be hard: just grab the code in Python 2.7 and make it a stand-
alone function that can be imported. 

If you get lots of community interest in this, that is a good sign that 
the solution is useful and practical, and then you can push to have it 
included in the standard library or even as a built-in.

And if not, well, at least you will be able to continue using cmp in your 
own code.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: FBI wants public help solving encrypted notes from murder mystery

2011-03-30 Thread Graham Cooper
On Mar 31, 12:18 pm, Stretto stre...@nowhere.com wrote:
 Joe Snodgrass joe.s...@yahoo.com wrote in message

 news:c37e8e0b-a825-4ac5-9886-8828ab1fa...@x8g2000prh.googlegroups.com...







  FBI cryptanalysis hasn’t decrypted notes from 1999 murder mystery

 http://tinyurl.com/4d56zsz

  The FBI is seeking the public's help in breaking the encrypted code
  found in two notes discovered on the body of a murdered man in 1999.

  The FBI says that officers in St. Louis, Missouri discovered the body
  of 41-year-old Ricky McCormick on June 30, 1999 in a field and the
  clues regarding the homicide were two encrypted notes found in the
  victim's pants pockets.

  The FBI says that despite extensive work by its Cryptanalysis and
  Racketeering Records Unit (CRRU), and the American Cryptogram
  Association, the meanings of those two coded notes remain a mystery
  and McCormick's murderer has never been found. One has to wonder
  though, if the FBI can't figure this out, who can? But I digress.

  From the FBI: The more than 30 lines of coded material use a
  maddening variety of letters, numbers, dashes, and parentheses.
  McCormick was a high school dropout, but he was able to read and write
  and was said to be 'street smart.' According to members of his family,
  McCormick had used such encrypted notes since he was a boy, but
  apparently no one in his family knows how to decipher the codes, and
  it's unknown whether anyone besides McCormick could translate his
  secret language. Investigators believe the notes in McCormick's
  pockets were written up to three days before his death.

  Standard routes of cryptanalysis seem to have hit brick walls, said
  CRRU chief Dan Olson in a statement. To move the case forward,
  examiners need another sample of McCormick's coded system-or a similar
  one-that might offer context to the mystery notes or allow valuable
  comparisons to be made. Or, short of new evidence, Olson said, Maybe
  someone with a fresh set of eyes might come up with a brilliant new
  idea.

  The FBI says it has always relied on public tips and other assistance
  to solve crimes though breaking a code may represent a special
  circumstance.

  For larger images of the notes go here. [LINK]

  If you have an idea how to break the code, have seen similar codes, or
  have any information about the Ricky McCormick case, write to CRRU at
  the following address:

  FBI Laboratory
  Cryptanalysis and Racketeering Records Unit
  2501 Investigation Parkway
  Quantico, VA 22135
  Attn: Ricky McCormick Case

  There is no reward being offered, just the knowledge that you may be
  solving an intriguing murder mystery, the FBI stated.

 No other information about the guy? It might help. If the note is of any use
 then people and places would be in it. If that is the case then it would
 help to know where he lived and some of the names of people he knows.

 The note seems like it may not be just encrypted but a sort of
 compression(or rather shorthand/jargon) was used. Was the guy a drug dealer?
 It could be a list of clients or information about where he sold drugs(the
 numbers look like street addresses or amounts.

 If these kinda notes were so common from this guy then surely the FBI should
 have many more?

 Seems like the FBI could do more if they wanted it really solved..



I can use my psychic powers to solve the crime!

I did a test on the Australian Channel 9 News website a few months
ago...

Given a sequence of photos tell who is a notorious criminal and who is
a professional surfer!

I got every one right!  My psychic channels were spot on, e.g. had a
big magazine following - SURFER



G. Adam
-- 
http://mail.python.org/mailman/listinfo/python-list


Forcing absolute package imports in 2.7?

2011-03-30 Thread Michael Parker
Hi all,

I'm reading Learning Python 4th Edition by Lutz. In the section on
relative package imports, he says: In Python 3.0, the `import
modname` statement is always absolute, skipping the containing
package’s directory. In 2.6, this statement form still performs
relative imports today (i.e., the package’s directory is searched
first), but these will become absolute in Python 2.7, too.`

But in my own testing I'm not seeing this behavior. Was it not
included in 2.7 for fear of breaking too many programs?

Thanks!
- Mike
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sudden error: SyntaxError: Non-ASCII character '\xc2' in file

2011-03-30 Thread Terry Reedy

On 3/30/2011 7:58 PM, Gnarlodious wrote:

On Mar 30, 9:28 am, Peter Otten wrote:


You are trying to run your 3.x code with Python 2.x...


You're right. Exactly why this started happening I don't know.


I believe recent Mac OSX comes with some 2.x installed as the default 
Python.


--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


Re: Fun python 3.2 one-liner

2011-03-30 Thread Gregory Ewing

Martin De Kauwe wrote:

what is the character limit on a one liner :P.


For PEP 8 compliance, 80 characters. :-)

--
Greg
--
http://mail.python.org/mailman/listinfo/python-list


Learn Python the Hardway exercise 11 question 4

2011-03-30 Thread Joseph Sanoyo
print How old are you?, age = raw_input()
print How tall are you?, height = raw_input()
print How much do you weigh?, weight = raw_input()
print So, you're %r old, %r tall and %r heavy. % ( age, height,
weight)
Note:
Notice that we put a , (comma) at the end of each print line. This is
so that print doesn’t end the line with a newline and go to the next
line.
What You Should See
Extra Credit
1. Go online and find out what Python’s raw_input does.
$ python ex11.py How old are you?
35 How tall are you?
6'2 How much do you weigh? 180lbs
So, you're '35' old, '6\'2' tall and '180lbs' heavy.

Related to escape sequences, try to find out why the last line has
’6\’2’ with that \’ sequence. See how the single-quote needs to be
escaped because otherwise it would end the string?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: delete namespaces

2011-03-30 Thread Chris Angelico
On Thu, Mar 31, 2011 at 11:11 AM, Raymond Hettinger pyt...@rcn.com wrote:
 [monkeys paw]
  How do i delete a module namespace once it has been imported?
  . . .
  Then i make a modification to banner.py. When i import it again,
  the new changes are not reflected.

 [Terry Reedy]
 The best thing, if possible, is to restart the program.
 If you develop banner.py with adequate tests, you will want to restart
 the test anyway, and you should not need to modify much thereafter.

 This is excellent advice.

 You're much better-off starting fresh each time.

Each language should be used for its strengths, not its weaknesses :)
If you're using Python, keep it light and simple and then just restart
the program. If you want to reload stuff without restarting, grab
Pike. There's no point fighting your language!

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: delete namespaces

2011-03-30 Thread Ritesh Nadhani
On Tue, Mar 29, 2011 at 6:14 PM, monkeys paw mon...@joemoney.net wrote:
 How do i delete a module namespace once it has been imported?

 I use

 import banner

 Then i make a modification to banner.py. When i import it again,
 the new changes are not reflected. Is there a global variable i can
 modify?
 --
 http://mail.python.org/mailman/listinfo/python-list


Have a look at:

http://washort.twistedmatrix.com/2011/01/introducing-exocet.html

-- 
Ritesh
http://www.beamto.us
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: FBI wants public help solving encrypted notes from murder mystery

2011-03-30 Thread David Bernier

Stretto wrote:



Joe Snodgrass joe.s...@yahoo.com wrote in message
news:c37e8e0b-a825-4ac5-9886-8828ab1fa...@x8g2000prh.googlegroups.com...


FBI cryptanalysis hasn’t decrypted notes from 1999 murder mystery

http://tinyurl.com/4d56zsz

The FBI is seeking the public's help in breaking the encrypted code
found in two notes discovered on the body of a murdered man in 1999.

The FBI says that officers in St. Louis, Missouri discovered the body
of 41-year-old Ricky McCormick on June 30, 1999 in a field and the
clues regarding the homicide were two encrypted notes found in the
victim's pants pockets.

The FBI says that despite extensive work by its Cryptanalysis and
Racketeering Records Unit (CRRU), and the American Cryptogram
Association, the meanings of those two coded notes remain a mystery
and McCormick's murderer has never been found. One has to wonder
though, if the FBI can't figure this out, who can? But I digress.

From the FBI: The more than 30 lines of coded material use a
maddening variety of letters, numbers, dashes, and parentheses.
McCormick was a high school dropout, but he was able to read and write
and was said to be 'street smart.' According to members of his family,
McCormick had used such encrypted notes since he was a boy, but
apparently no one in his family knows how to decipher the codes, and
it's unknown whether anyone besides McCormick could translate his
secret language. Investigators believe the notes in McCormick's
pockets were written up to three days before his death.

Standard routes of cryptanalysis seem to have hit brick walls, said
CRRU chief Dan Olson in a statement. To move the case forward,
examiners need another sample of McCormick's coded system-or a similar
one-that might offer context to the mystery notes or allow valuable
comparisons to be made. Or, short of new evidence, Olson said, Maybe
someone with a fresh set of eyes might come up with a brilliant new
idea.

The FBI says it has always relied on public tips and other assistance
to solve crimes though breaking a code may represent a special
circumstance.

For larger images of the notes go here. [LINK]

If you have an idea how to break the code, have seen similar codes, or
have any information about the Ricky McCormick case, write to CRRU at
the following address:

FBI Laboratory
Cryptanalysis and Racketeering Records Unit
2501 Investigation Parkway
Quantico, VA 22135
Attn: Ricky McCormick Case

There is no reward being offered, just the knowledge that you may be
solving an intriguing murder mystery, the FBI stated.


No other information about the guy? It might help. If the note is of any
use then people and places would be in it. If that is the case then it
would help to know where he lived and some of the names of people he knows.

The note seems like it may not be just encrypted but a sort of
compression(or rather shorthand/jargon) was used. Was the guy a drug
dealer? It could be a list of clients or information about where he
sold drugs(the numbers look like street addresses or amounts.

If these kinda notes were so common from this guy then surely the FBI
should have many more?

Seems like the FBI could do more if they wanted it really solved...


First of all, out of respect for the deceased, Ricky McCormick and
in keeping with a spirit of fairness, I must say that what follows
may be pure coincidence, perhaps a 10% chance of mistaken identity
and a 90% chance of not-mistaken identity.

Background on a Joplin, Missouri 1982 killing/murder
the person killed:   Darrell Ruestman
the killer:  Alan J. Bannister

The prosecution's theory was that AJ Bannister murdered Darrell Ruestman.
This led to AJ Bannister's murder conviction, which was upheld
on appeal.

But see this if you wish for another theory:
 http://pubs.socialistreviewindex.org.uk/sr214/usletter.htm  .

In any case, Darrell Ruestman was killed in 1982.

From the case:  BANNISTER v. DELO,
 
http://mo.findacase.com/research/wfrmDocViewer.aspx/xq/fac.%2FFDCT%2FWMO%2F1995%2F19950915_019.WMO.htm/qx 



This court opinion mentions three affidavits:
1. Wooten Affidavit
2. Taylor Affidavit
3. Trombley Affidavit  (writer and film maker)

In the Trombley Affidavit, one finds:
Finally, Trombley's statement about what Bannister says happened directly 
contradicts the testimony of Linda McCormick, Ruestman's girlfriend, who was in 
the trailer at the time of the murder and testified that she heard no 
conversations before hearing the shot. See Tr. III at 49, 65. 


and also:

For instance, Trombley links McCormick to Wooten and Wooten to Ruestman's 
murder (thereby conflicting with Wooten's affidavit). However, Trombley also 
connects Wooten and Bannister. See affidavit at 9. These facts could support the 
State's theory that Wooten, acting as a middleman for McCormick, hired Bannister 
to murder Ruestman just as easily as they support Trombley's accidental shooting 
theory.


From another web page:
On August 20, 1982, Darrell Ruestman was living in a 

Re: delete namespaces

2011-03-30 Thread rusi
On Mar 30, 6:14 am, monkeys paw mon...@joemoney.net wrote:
 How do i delete a module namespace once it has been imported?

 I use

 import banner

 Then i make a modification to banner.py. When i import it again,
 the new changes are not reflected. Is there a global variable i can
 modify?

It seems you are asking about modules and namespaces whereas you
actually want to ask about how to optimize your development
environment -- Yes?
IOW a programmer normally starts with a vague idea, moves to/through
increasing details with the implementation moving from incomplete to
buggy to finished.

Modules (and shrink wrapping in general) is good in the later stages
and a nuisance in the earlier.
As an alternative if you use emacs and python-mode then you can hack
away with C-c C-c (py-execute-buffer) without the problem you
describe.  Then module-arize when done.
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue11717] conflicting definition of ssize_t in pyconfig.h

2011-03-30 Thread Wolfgang Rohdewald

Wolfgang Rohdewald wolfg...@rohdewald.de added the comment:

types.h is from kdewin/include/msvc/sys

git clone git://anongit.kde.org/kdewin

types.h uses SSIZE_T but that is nowhere defined in KDE, so it must be the 
original one from msvc

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11717
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11393] Integrate faulthandler module into Python 3.3

2011-03-30 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

   - speed up the test: because dump_backtraces_later() has now a
  subsecond resolution, we can use sleep of 50 ms instead of 1 sec
 
 This is too short, there may be random failures on some slow buildbots.
 IMO, 0.5s is the minimum you can use.

Ok, changed.

 The docstring is outdated.

fixed

  It also seems the cancel option isn't
 useful anymore, you could remove it and simplify the test.

cancel is used by test_dump_tracebacks_later_repeat_cancel() to check
that faulthandler.cancel_dump_tracebacks_later() did cancel the last
dump_backtraces_later() request.

 +process = script_helper.spawn_python('-c', code)
 +stdout, stderr = process.communicate()
 
 Shouldn't you check the return code as well?

Yes, except for fatal errors, because the C library exits with a
non-zero exit code (e.g. 139 for a SIGSEGV on Linux). I added a check on
the exit code.

 +code = \n.join(code)
 
 Again, I think it would make the code simpler and more maintainable if
 you used triple-quoted strings instead of lists/tuples.

Ok ok, done

 When you launch a waiting thread in a subprocess, I think it's better to
 set it in daemon mode so as to avoid blocking if the main thread raises
 an exception.

I doesn't know that. fixed

 You have a #ifdef MS_WINDOWS in check_signum() but that function is
 not compiled under Windows (it is inside #ifdef FAULTHANDLER_USER).

Ah yes, the code became useless: removed

--

Other changes:

 - faulthandler_fatal_error() calls the previous signal handler using
raise(signum). Before, the signal was raised again because the same
instruction was executed again, and it raised the same fault. But if the
user sends manually a fatal signal to the process, the signal was
ignored because of the fault handler (but the traceback was displayed).
 - use SA_NODEFER and SA_RESTART flags in enable() and register()
 - faulthandler_get_fileno() accepts fileno()==0
 - cleanup the doc

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11393
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11393] Integrate faulthandler module into Python 3.3

2011-03-30 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


Added file: http://bugs.python.org/file21470/a979bb83a94b.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11393
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11393] Integrate faulthandler module into Python 3.3

2011-03-30 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


Removed file: http://bugs.python.org/file21467/c684b1e59aaa.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11393
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8052] subprocess close_fds behavior should only close open fds

2011-03-30 Thread Charles-Francois Natali

Charles-Francois Natali neolo...@free.fr added the comment:

 I wonder whether the Java people are simply unaware of the potential problem?
 Or perhaps they have checked the Linux and Solaris implementations of 
 readdir()
 and confirmed that it is in fact safe on those platforms. Even if this is the
 case, I would be wary of doing things the same way - there's no guarantee that
 the implementation won't change out from underneath us.

The problem is not so much readdir: if you look at the source code
(http://fxr.googlebit.com/source/lib/libc/gen/readdir.c), it doesn't
do much apart from locking a mutex private to the related DIR *, so as
long as you pass it a DIR * not referenced elsewhere (which would be
the case since it would call opendir between the fork and exec), it
should be ok. The man page
(http://pubs.opengroup.org/onlinepubs/007908799/xsh/readdir.html) also
makes it clear:
After a call to fork(), either the parent or child (but not both)
may continue processing the directory stream using readdir(),
rewinddir() or seekdir().  If both the parent and child processes use
these functions, the result is undefined.

The problem is more with opendir, which needs to allocate memory for
the struct dirent before calling getdents syscall.

I agree with you, we should definitely favor correctness over efficiency.

As for the other approach, I'm not aware of any portable way to
determine if a program is multi-threaded. Also, as noted by Victor,
there might be room for some subtle races (Python-registered signal
handlers are called synchronously from the main eval loop with the GIL
held, so I don't think there should be a problem there, but you might
have a problem with C-extension registered signal handlers).

Finally, looking at this thread
http://lists.freebsd.org/pipermail/freebsd-hackers/2007-July/021132.html,
it seems that some closefrom implementations are definitely not
async-safe, which is a pity...

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8052
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11717] conflicting definition of ssize_t in pyconfig.h

2011-03-30 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

Should Python.h systematically avoid defining symbols without a Py prefix?
See attached patch, which defines Py_ssize_t in pyconfig.h.

The same can be said for other symbols defined there: pid_t, copysign, hypot.

--
keywords: +patch
nosy: +amaury.forgeotdarc
Added file: http://bugs.python.org/file21472/no-ssize_t.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11717
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11155] multiprocessing.Queue's put() signature differs from docs

2011-03-30 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

Technically this is a backward-incompatible change, because it breaks code that 
uses obj=foo explicitly.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11155
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9285] A decorator for cProfile and profile modules

2011-03-30 Thread Tennessee Leeuwenburg

Tennessee Leeuwenburg tleeuwenb...@gmail.com added the comment:

I have been working on a similar idea. I just wanted to raise an issue I ran 
into which might affect this code also. The decorated function ended up with a 
different function signature to the original inner function. This can be 
important sometimes. I had to use the decorator.decorator module to give the 
outer function the same signature as the inner function.

--
nosy: +tleeuwenb...@gmail.com

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9285
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11720] PyErr_WriteUnraisable while running cProfile

2011-03-30 Thread Tennessee Leeuwenburg

New submission from Tennessee Leeuwenburg tleeuwenb...@gmail.com:

I am happy to come up with a minimal test for this if that would help, but 
repeating the problem is not hard. Take a Python2.7 interpreter, install the 
decorator module from PyPi, and also the code at 
https://bitbucket.org/tleeuwenburg/benchmarker.py/. Running test_benchmarker.py 
will cause the problem.

Exception TypeError: 'str' object is not callable in 
'/tmp/benchlog/2011/30/2011_03_30_09_41.pstats' ignored

I've tracked this message down and it's likely being writted to stdout by 
errors.c, where unraisable exceptions are handled.

Using hotshot, and otherwise the same code, the error does not occur. 
Diagnosing the true cause of this issue is probably beyond me, but I'm more 
than happy to try to come up with a more minimal example or help any way I can.

--
components: Interpreter Core
messages: 132577
nosy: tleeuwenb...@gmail.com
priority: normal
severity: normal
stage: test needed
status: open
title: PyErr_WriteUnraisable while running cProfile
type: behavior
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11720
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11720] PyErr_WriteUnraisable while running cProfile

2011-03-30 Thread Tennessee Leeuwenburg

Tennessee Leeuwenburg tleeuwenb...@gmail.com added the comment:

Never mind, I was doing something stupid. The error message doesn't really make 
it terribly obvious, but the cause is in my code.

--
resolution:  - invalid
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11720
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11393] Integrate faulthandler module into Python 3.3

2011-03-30 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

 faulthandler_fatal_error() calls the previous signal handler
 using raise(signum)

It doesn't work as expected on Windows: Windows doesn't call its own signal 
handler anymore. Use the previous code (only on Windows).

I also added a test for stack overflow: it fails on FreeBSD because I called 
sigaltstack() with the wrong arguments. It is now fixed.

test_faulthandler pass on Linux, Windows and FreeBSD.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11393
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9067] Use macros from pyctype.h

2011-03-30 Thread Andrej Krpic

Changes by Andrej Krpic akrpi...@gmail.com:


--
nosy: +akrpic77

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9067
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10966] eliminate use of ImportError implicitly representing SkipTest

2011-03-30 Thread Andrej Krpic

Changes by Andrej Krpic akrpi...@gmail.com:


--
nosy: +akrpic77

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10966
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9067] Use macros from pyctype.h

2011-03-30 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

Sandro Tosi rep...@bugs.python.org wrote:
 Hi Stefan, can you please expand a bit this issue and details the places 
 you think can benefit from pyctype macros? you know, a patch would be the 
 best :)

Indeed. While working on #9036 I thought that there were several places
that could use the macros. I opened this as a reminder for myself but
then got sidetracked, so now I'll have to search for the precise locations
again.

--
priority: normal - low

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9067
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11715] Building Python on multiarch Debian and Ubuntu

2011-03-30 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
nosy: +jcea

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11715
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11721] socket.accept() with a timout socket creates bogus socket

2011-03-30 Thread Kristján Valur Jónsson

New submission from Kristján Valur Jónsson krist...@ccpgames.com:

I found this defect at PyCon 2011 after spending a lot of type fidgeting with 
ssl.  The test_ssl.py unittest was using timeout on accept sockets and it was 
working fine there, but not with the code I was working out.  Turns out that 
_ssl.py resets the timeout state of sockets, but not regular sockets.

In short:  If you have a socket with settimeout(1), then accept a connection on 
it, the new socket will have gettimeout()==None, but its state will still 
(internally) be non-blocking.  The attached script demonstrates the issue.

This is an issue with all versions of python from 2.5 upwards.

There are basically two things we can do to fis this:
1) retain gettimeout()=None but internally make sure we set the resulting 
socket to blocking mode
2) have the accepted socket inherit the timeout properties of the parent socket 
properly, and so inherit its timeout value too.

Number 2 is more in line with expected BSD socket behaviour that sockets at 
least inherit the non-blocking attribute of their parent socket.

--
components: IO
files: bug.py
messages: 132581
nosy: krisvale
priority: normal
severity: normal
status: open
title: socket.accept() with a timout socket creates bogus socket
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 
3.3, Python 3.4
Added file: http://bugs.python.org/file21473/bug.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11721
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11721] socket.accept() with a timout socket creates bogus socket

2011-03-30 Thread Kristján Valur Jónsson

Changes by Kristján Valur Jónsson krist...@ccpgames.com:


--
type:  - behavior

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11721
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11721] socket.accept() with a timout socket creates bogus socket

2011-03-30 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 In short:  If you have a socket with settimeout(1), then accept a
 connection on it, the new socket will have gettimeout()==None, but its 
 state will still (internally) be non-blocking.  The attached script
 demonstrates the issue.

This should have been fixed in ed0259230611. Can you confirm?

--
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11721
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11717] conflicting definition of ssize_t in pyconfig.h

2011-03-30 Thread Wolfgang Rohdewald

Changes by Wolfgang Rohdewald wolfg...@rohdewald.de:


--
nosy: +mhammond

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11717
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11721] socket.accept() with a timout socket creates bogus socket

2011-03-30 Thread Kristján Valur Jónsson

Kristján Valur Jónsson krist...@ccpgames.com added the comment:

I cannot see from the link to which branch that was committed, or what 
revision.  But I assume it is the default branch.  I can confirm that this 
appears to be fixed.

The corresponding defect has a long (and bothersome) discussion.  I am, 
however, surprised that this was not considered a bug and backported.

The bug is pretty clear:  socket.gettimeout() returns None, and yet 
socket.recv() returns in EWOULDBLOCK.  This is clearly against spec, since the 
gettimeout() == None means that the socket is supposed to be blocking.

I can agree with the fix (my number 1 suggestion) but I would have liked to see 
it done in socketmodule.c where the timeout semantics are all defined, rather 
than as a cludgy special case in socket.py

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11721
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11721] socket.accept() with a timout socket creates bogus socket

2011-03-30 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 The corresponding defect has a long (and bothersome) discussion.  I am, 
 however, surprised that this was not considered a bug and backported.

I think Martin's argument was that it could break compatibility.

 I can agree with the fix (my number 1 suggestion) but I would have
 liked to see it done in socketmodule.c where the timeout semantics are 
 all defined, rather than as a cludgy special case in socket.py

There's definitely a reason for doing it in socket.py rather than 
socketmodule.c, although I don't remember which one.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11721
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11393] Integrate faulthandler module into Python 3.3

2011-03-30 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


Added file: http://bugs.python.org/file21474/4adbea7c832e.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11393
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11647] function decorated with a context manager can only be invoked once

2011-03-30 Thread ysj.ray

ysj.ray ysj@gmail.com added the comment:

Got it. Here is my updated patch. Not sure if the doc is proper.

--
Added file: http://bugs.python.org/file21475/issue_11647_2.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11647
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11393] Integrate faulthandler module into Python 3.3

2011-03-30 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


Removed file: http://bugs.python.org/file21470/a979bb83a94b.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11393
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11393] Integrate faulthandler module into Python 3.3

2011-03-30 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


Added file: http://bugs.python.org/file21476/f5a11df83d98.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11393
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11393] Integrate faulthandler module into Python 3.3

2011-03-30 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


Removed file: http://bugs.python.org/file21474/4adbea7c832e.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11393
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11393] Integrate faulthandler module into Python 3.3

2011-03-30 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

 My TODO list is empty (the last item was fix register() to be signal
 safe) so I think that the patch is ready to be commited.

As I wrote, I did some tests on FreeBSD, found bugs and fixed them. I also 
fixed the weird behaviour if the user sends manually a fatal signal (like 
SIGSEGV): it is no more ignored. And I patched test_faulthandler to not create 
core files. On Windows, there is still a popup warning the user a fatal error 
occured. I don't know how to disable (temporary) this popup.

Here is the updated patch and I hope the final patch.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11393
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11654] errors in atexit hooks don't change process exit code

2011-03-30 Thread ysj.ray

ysj.ray ysj@gmail.com added the comment:

see #1257

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11654
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11393] Integrate faulthandler module into Python 3.3

2011-03-30 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

  - speed up the test: because dump_backtraces_later() has now a
 subsecond resolution, we can use sleep of 50 ms instead of 1 sec

This is too short, there may be random failures on some slow buildbots.
IMO, 0.5s is the minimum you can use.

+def _check_dump_tracebacks_later(self, repeat, cancel, filename):
+
+Call dump_tracebacks_later() two times, or three times if
repeat is True.
+Check the output: the traceback may be written 1, 2 or 3 times
+depending on repeat and cancel options.
+
+Raise an error if the output doesn't match the expect format.
+

The docstring is outdated. It also seems the cancel option isn't
useful anymore, you could remove it and simplify the test.

+process = script_helper.spawn_python('-c', code)
+stdout, stderr = process.communicate()

Shouldn't you check the return code as well?

+code = \n.join(code)

Again, I think it would make the code simpler and more maintainable if
you used triple-quoted strings instead of lists/tuples.

When you launch a waiting thread in a subprocess, I think it's better to
set it in daemon mode so as to avoid blocking if the main thread raises
an exception.

You have a #ifdef MS_WINDOWS in check_signum() but that function is
not compiled under Windows (it is inside #ifdef FAULTHANDLER_USER).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11393
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7443] test.support.unlink issue on Windows platform

2011-03-30 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 * Patch Py_DeleteFileW in posixmodule.c so that it renames before
 deleting: should solve the problem overall but obviously has a
 possible wider impact, in general and on performance in particular.
 This rename might be a simple rename-to-guid or something more
 sophisticated such as the rename-to-recycler which cygwin uses.
 
 * Patch support.unlink in the test package to do the rename dance on
 the basis that it'll fix at least some of the problems with less
 impact overall.
 
 Opinions? I'm willing to do either.

Well, since I'm not a Windows expert, I can only give an intuitive
opinion. I think that we should start with patching support.unlink();
tweaking Py_DeleteFile() so as to do something more sophisticated than a
simple removal sounds like it could hide some behaviour change that
could hit some legitimate uses.

(as an aside, for higher-level variants of OS functions, the shutil may
be an appropriate recipient)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7443
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1257] atexit errors should result in nonzero exit code

2011-03-30 Thread ysj.ray

ysj.ray ysj@gmail.com added the comment:

I think there is no need to implement this in python2.x since it's a  behavior 
change which could introduce some compatibility issues to someone's code, 
besides in 2.x both sys.exitfunc and atexit module should be considered, that 
makes the code looks complex. The sys.exitfunc is removed in 3.x.

+1 on only implementing it in 3.3.

--
nosy: +ysj.ray
versions: +Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1257
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7995] On Mac / BSD sockets returned by accept inherit the parent's FD flags

2011-03-30 Thread Kristján Valur Jónsson

Kristján Valur Jónsson krist...@ccpgames.com added the comment:

Please see issue 11721 where I was commenting on the same.

I don't think the documentation makes it clear that socket.gettimeout() can be 
incorrect (i.e. return None when the socket is non-blocking).

I also don't think there is a portable way to detect the NBIO attribute of a 
socket, so we still have a case of socket.gettimeout() not accurately 
reflecting the blocking state of the socket.  If people don't think it is a 
bug, then this fact should be documented.

I personally think that this logic should go into socketmodule.c where the rest 
of the timeout logic sits, rather than be exctracted like this out into the 
python world.

Finally, IMHO this is a bug that should be backported as far back as possible.

Cheers!

--
nosy: +krisvale

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7995
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11721] socket.accept() with a timout socket creates bogus socket

2011-03-30 Thread Kristján Valur Jónsson

Changes by Kristján Valur Jónsson krist...@ccpgames.com:


--
resolution:  - duplicate
status: open - closed
superseder:  - On Mac / BSD sockets returned by accept inherit the parent's FD 
flags

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11721
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7995] On Mac / BSD sockets returned by accept inherit the parent's FD flags

2011-03-30 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 I also don't think there is a portable way to detect the NBIO attribute 
 of a socket, so we still have a case of socket.gettimeout() not 
 accurately reflecting the blocking state of the socket

Which case?

 I personally think that this logic should go into socketmodule.c where 
 the rest of the timeout logic sits, rather than be exctracted like this 
 out into the python world.

I think practicality beats purity. If putting it in socket.py ends up producing 
bugs, we'll have to consider moving it to the C extension. Until then, the 
Python code has the advantage of being clear and concise.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7995
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7995] On Mac / BSD sockets returned by accept inherit the parent's FD flags

2011-03-30 Thread Kristján Valur Jónsson

Kristján Valur Jónsson krist...@ccpgames.com added the comment:

socket.defaulttimeout(None)
s = socket.socket()
s.settimeout(0) #nonblocking
s.bind()
s2, a = s.accept()
print s2.gettimeout() #prints ´none´, meaning blocking
s2.receive(10) #raises EWOULDBLOCK error, since internally it is non-blocking

I don't agree with practicality vs. purity, particularly when trying to 
understand the timeout logic.  Most of the timeout logic is implemented in c 
and never touched by python, in init_sockobject().  But then you tack on extra 
logic in socket.py, in what is even a socket object wrapper.  This means that 
any module that uses the pure _socket.socket object, such as C extensions, 
will not get the correct behaviour.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7995
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7995] On Mac / BSD sockets returned by accept inherit the parent's FD flags

2011-03-30 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 socket.defaulttimeout(None)
 s = socket.socket()
 s.settimeout(0) #nonblocking
 s.bind()
 s2, a = s.accept()
 print s2.gettimeout() #prints ´none´, meaning blocking
 s2.receive(10) #raises EWOULDBLOCK error, since internally it is non-blocking

Could you post working Python 3 code which demonstrates the issue on
3.3?

 This means that any module that uses the pure _socket.socket object,
 such as C extensions, will not get the correct behaviour.

Using undocumented implementation details (such as the _socket module)
is, AFAIK, unsupported.

Anyway, if you want the code to be changed, please propose a patch so
that it can be judged on its own merits (together with tests that
demonstrate the improvement, if any).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7995
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11722] mingw64 does not link when building extensions

2011-03-30 Thread Jason Morgan

New submission from Jason Morgan jas...@picochip.com:

Bulding a simple extension (the spam example) fails with mingw64.

in modsupport.h, the following is used to detect 64bit, it does not work with 
mingw64.

#if SIZEOF_SIZE_T != SIZEOF_INT
/* On a 64-bit system, rename the Py_InitModule4 so that 2.4
   modules cannot get loaded into a 2.5 interpreter */
#define Py_InitModule4 Py_InitModule4_64
#endif

This code never compiles, you can test this by placing similar code and filling 
it with rubbish.

This means it thinks the extension is being built on a 32bit compiler and 
creates the wrong call for Py_InitModule.

Workaround:
Explicitly calling Py_InitModule4_64() in extension and declaring 
Py_InitModule4_64(...) in code. Note this does not complain about 
re-declaration and builds OK because declaration is wrong.
e.g.
//m=Py_InitModule(spam, SpamMethods);
m = Py_InitModule4_64(spam, SpamMethods,(char *)NULL, (PyObject *)NULL, 
PYTHON_API_VERSION);


Or, a better more portable permanent fix, define WIN64 in code and
modify modsupport.h:
#if SIZEOF_SIZE_T != SIZEOF_INT || defined(WIN64)
/* On a 64-bit system, rename the Py_InitModule4 so that 2.4
   modules cannot get loaded into a 2.5 interpreter */
#define Py_InitModule4 Py_InitModule4_64
#endif

I am sure there are other, more standard ways.

--
components: Extension Modules
messages: 132595
nosy: moog
priority: normal
severity: normal
status: open
title: mingw64 does not link when building extensions
type: compile error
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11722
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11393] Integrate faulthandler module into Python 3.3

2011-03-30 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

I merged the faulthandler branch into the default branch. I removed __version__ 
field: the Python version should be enough. I also fixed an infinite loop 
raised by test_capi.

test_faulthandler pass on Solaris and OpenIndiana, but it fails on PPC:



==
FAIL: test_enable_file (test.test_faulthandler.FaultHandlerTests)
--
Traceback (most recent call last):
  File 
/Users/buildbot/buildarea/custom.parc-leopard-1/build/Lib/test/test_faulthandler.py,
 line 166, in test_enable_file
filename=filename)
  File 
/Users/buildbot/buildarea/custom.parc-leopard-1/build/Lib/test/test_faulthandler.py,
 line 84, in check_fatal_error
self.assertEqual(lines, expected)
AssertionError: Lists differ: ['Fatal Python error: Bus erro... != ['Fatal 
Python error: Segmenta...

First differing element 0:
Fatal Python error: Bus error
Fatal Python error: Segmentation fault

- ['Fatal Python error: Bus error',
+ ['Fatal Python error: Segmentation fault',
   '',
   'Traceback (most recent call first):',
   '  File string, line 4 in module']

==
FAIL: test_enable_threads (test.test_faulthandler.FaultHandlerTests)
--
Traceback (most recent call last):
  File 
/Users/buildbot/buildarea/custom.parc-leopard-1/build/Lib/test/test_faulthandler.py,
 line 176, in test_enable_threads
all_threads=True)
  File 
/Users/buildbot/buildarea/custom.parc-leopard-1/build/Lib/test/test_faulthandler.py,
 line 84, in check_fatal_error
self.assertEqual(lines, expected)
AssertionError: Lists differ: ['Fatal Python error: Bus erro... != ['Fatal 
Python error: Segmenta...

First differing element 0:
Fatal Python error: Bus error
Fatal Python error: Segmentation fault

- ['Fatal Python error: Bus error',
+ ['Fatal Python error: Segmentation fault',
   '',
   'Current thread XXX:',
   '  File string, line 3 in module']

==
FAIL: test_gil_released (test.test_faulthandler.FaultHandlerTests)
--
Traceback (most recent call last):
  File 
/Users/buildbot/buildarea/custom.parc-leopard-1/build/Lib/test/test_faulthandler.py,
 line 154, in test_gil_released
'Segmentation fault')
  File 
/Users/buildbot/buildarea/custom.parc-leopard-1/build/Lib/test/test_faulthandler.py,
 line 84, in check_fatal_error
self.assertEqual(lines, expected)
AssertionError: Lists differ: ['Fatal Python error: Bus erro... != ['Fatal 
Python error: Segmenta...

First differing element 0:
Fatal Python error: Bus error
Fatal Python error: Segmentation fault

- ['Fatal Python error: Bus error',
+ ['Fatal Python error: Segmentation fault',
   '',
   'Traceback (most recent call first):',
   '  File string, line 3 in module']

==
FAIL: test_sigfpe (test.test_faulthandler.FaultHandlerTests)
--
Traceback (most recent call last):
  File 
/Users/buildbot/buildarea/custom.parc-leopard-1/build/Lib/test/test_faulthandler.py,
 line 104, in test_sigfpe
'Floating point exception')
  File 
/Users/buildbot/buildarea/custom.parc-leopard-1/build/Lib/test/test_faulthandler.py,
 line 84, in check_fatal_error
self.assertEqual(lines, expected)
AssertionError: Lists differ: [] != ['Fatal Python error: Floating...

Second list contains 4 additional elements.
First extra element 0:
Fatal Python error: Floating point exception

- []
+ ['Fatal Python error: Floating point exception',
+  '',
+  'Traceback (most recent call first):',
+  '  File string, line 3 in module']

==
FAIL: test_sigsegv (test.test_faulthandler.FaultHandlerTests)
--
Traceback (most recent call last):
  File 
/Users/buildbot/buildarea/custom.parc-leopard-1/build/Lib/test/test_faulthandler.py,
 line 93, in test_sigsegv
'Segmentation fault')
  File 
/Users/buildbot/buildarea/custom.parc-leopard-1/build/Lib/test/test_faulthandler.py,
 line 84, in check_fatal_error
self.assertEqual(lines, expected)
AssertionError: Lists differ: ['Fatal Python error: Bus erro... != ['Fatal 
Python error: Segmenta...

First differing element 0:
Fatal Python error: Bus error
Fatal Python error: Segmentation fault

- ['Fatal Python error: Bus error',
+ ['Fatal Python error: Segmentation fault',
   '',
   'Traceback (most recent call first):',
   '  File string, line 3 in module']

--

--

___

[issue11723] No proper support for mingw64 - patch to add

2011-03-30 Thread Jason Morgan

New submission from Jason Morgan jas...@picochip.com:

Python2.7 has no proper support for mings64.  You can use environment path to 
trick compiler into using mings64, but this will cause conflict with other 
builds.
Adding a mings64 compiler options is much more sensible as both mingw32 and 
mings64 can co-exist. (mingw64 has a prefix for all it's exe's)

Suggest following patch, tested with mingw-w64-1.0-bin_i686-mingw_20110328 and 
Python-2.7.1(x64) on Windows7.

Diff attached.

See related issue 11722

--
components: Extension Modules
files: mingw64.diff
keywords: patch
messages: 132597
nosy: moog
priority: normal
severity: normal
status: open
title: No proper support for mingw64 - patch to add
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file21477/mingw64.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11723
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7995] On Mac / BSD sockets returned by accept inherit the parent's FD flags

2011-03-30 Thread Daniel Stutzbach

Daniel Stutzbach stutzb...@google.com added the comment:

I'm confused by the patch (ed0259230611).  The patch comment and the NEWS item 
state the returned socket is now always non-blocking but the code change adds 
sock.setblocking(True).

--
nosy: +stutzbach

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7995
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11722] mingw64 does not link when building extensions

2011-03-30 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

What are the values of SIZEOF_SIZE_T and SIZEOF_INT with this compiler?
I'd expect them to be respectively 8 and 4.

--
nosy: +amaury.forgeotdarc

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11722
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10219] BufferedReader.read1 does not check for closed file

2011-03-30 Thread Sandro Tosi

Sandro Tosi sandro.t...@gmail.com added the comment:

Hi,
on a freshly built python 3.3 I got:

$ ./python 
Python 3.3a0 (default:22ae2b002865, Mar 30 2011, 20:18:39) 
[GCC 4.4.5] on linux2
Type help, copyright, credits or license for more information.
 f = open('foo', 'rb')
 print(f.read1(1)) # OK
b''
 f.close()
 print(f.read1(5)) # expected ValueError(I/O operation on closed file)
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: I/O operation on closed file
 print(f.peek())   # expected ValueError(I/O operation on closed file)
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: I/O operation on closed file
 

so it seems it's been fixed in the meantime. Do you have an example for 
BufferedReader?

--
nosy: +sandro.tosi

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10219
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >