ANN: PyNSource - Python UML tool - 1.6 released

2012-09-01 Thread Andy Bulka
Hi All,

Announcing PyNSource 1.6 with numerous new features.

http://www.andypatterns.com/index.php/products/pynsource/

Reverse engineer python source code into UML.

Version 1.6
- New animated spring layout algorithm
- Toggle between normal and Ascii UML view
- Colour sibling subclasses to understand the relationships in your uml diagram.
- Print and Print preview
- Persistence
- Improved AST based python code parsing
- Mac, Windows and Linux compatibility

Thanks for your interest.
Andy Bulka
www.andypatterns.com

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

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


ANN: gcc-python-plugin 0.10

2012-09-01 Thread David Malcolm
gcc-python-plugin is a plugin for GCC 4.6 onwards which embeds the
CPython interpreter within GCC, allowing you to write new compiler
warnings for C/C++ in Python, generate code visualizations, etc.  It
comes with cpychecker: a tool for static analysis tool of CPython
extensions.

Tarball releases are available at:
  https://fedorahosted.org/releases/g/c/gcc-python-plugin/

Prebuilt-documentation can be seen at:
  http://readthedocs.org/docs/gcc-python-plugin/en/latest/index.html

Project homepage:
  https://fedorahosted.org/gcc-python-plugin/

What's new in v0.10:
  * support for the to-be-released Python 3.3 (tested against latest
release candidate)

  * better support for analysis of C++ code: the API provides support
for walking the namespace tree, and the cpychecker code now supports
methods, references, this, destructors, etc

  * lots of bug fixes: the cpychecker code has been hardened by running
it on all of the Python C extension code in Fedora 17, and in the
process many internal bugs have been found and fixed - along with
hundreds of bugs in the code being tested:
http://fedoraproject.org/wiki/Features/StaticAnalysisOfPythonRefcounts

  * similarly, Daniele Varrazzo used the checker extensively on psycopg,
the popular Python interface to PostgreSQL, and using it was able to
find and fix numerous subtle errors:
http://initd.org/psycopg/articles/2012/03/29/psycopg-245-released/

  * an experimental new HTML visualization for error reports:
http://fedorapeople.org/~dmalcolm/gcc-python-plugin/2012-03-19/example/example.html

Thanks to Buck Golemon, Daniele Varrazzo, David Narvaez, Eevee, Jason
Mueller, Kevin Pyle, Matt Rice and Tom Tromey for their contributions to
this release.

Enjoy!
Dave



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

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


Cython 0.17 released

2012-09-01 Thread Stefan Behnel
Hello everyone,

on behalf of the Cython project team, I'm proud to announce the final
release of Cython 0.17. This is another major step forward in the
development of the Cython programming language that will make life easier
for a lot of users, rounds up some rough edges of the compiler and adds
(preliminary) support for CPython 3.3 and PyPy.

It is also the first final release of an implementation of PEP 380
(generator delegation), before it will eventually appear in CPython 3.3.


=== Download and Documentation ===

Download: http://cython.org/release/Cython-0.17.tar.gz

Release notes: http://wiki.cython.org/ReleaseNotes-0.17

Homepage: http://cython.org/

Documentation: http://docs.cython.org/


=== Major features of this release ===

* vastly improved integration with the C++ STL containers

  http://docs.cython.org/src/userguide/wrapping_CPlusPlus.html#standard-library

  http://docs.cython.org/src/tutorial/strings.html#c-strings

* yield from delegation between generators (PEP 380)

  http://www.python.org/dev/peps/pep-0380/

* alpha quality support for PyPy (via cpyext)

  http://docs.cython.org/src/userguide/pypy.html


=== What is Cython ? ===

Cython is a language with an optimising compiler that makes writing C
extensions for the Python language as easy as Python itself.

The Cython language is a superset of the Python language that additionally
supports calling C functions and declaring C types on variables and class
attributes. This allows the compiler to generate very efficient C code from
Cython code. The C code is generated once and then compiles with all major
C/C++ compilers in CPython 2.4 and later, including Python 3.x. PyPy
support is work in progress (on both sides) and is considered mostly usable
in Cython 0.17.

All of this makes Cython the ideal language for wrapping external C
libraries, embedding CPython into existing applications, and for fast C
modules that speed up the execution of Python code.


Have fun,

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

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


PyTexas: last day for $25 registration, talk proposal

2012-09-01 Thread Brad Allen
Just wanted to send out this quick reminder--today is the last day for
PyTexas $25 registration; starting tomorrow it will cost $50.

http://www.pytexas.org/chance/1/register/

Today is also your last day to post your talk proposals.

http://www.pytexas.org/chance/1/talks/add/

Btw, there is going to be a PyTexas t-shirt given away with every
registration. I've seen advance drafts which are beautiful, drawn and
colored by Kat Metgzer, the same artist who did the PyTexas 2010
t-shirt.  This evening after work I might be able to post the artwork
on the PyTexas blog.
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


ANN: A new version (0.3.1) of the Python module which wraps GnuPG has been released.

2012-09-01 Thread Vinay Sajip
A new version of the Python module which wraps GnuPG has been
released.

What Changed?
=
This is a minor enhancement and bug-fix release. See the project
website ( http://code.google.com/p/python-gnupg/ ) for more
information. Summary:

Better support for status messages from GnuPG.
Support for additional arguments to be passed to GnuPG.
Bugs in tests which used Latin-1 encoded data have been fixed by
specifying that encoding.
On verification (including after decryption), the signer trust level
is returned in integer and text formats.

The current version passes all tests on Windows (CPython 2.4, 2.5,
2.6, 2.7, 3.1 and Jython 2.5.1), Mac OS X (Python 2.5) and Ubuntu
(CPython 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2). On Windows, GnuPG 1.4.11
has been used for the tests.

What Does It Do?

The gnupg module allows Python programs to make use of the
functionality provided by the Gnu Privacy Guard (abbreviated GPG or
GnuPG). Using this module, Python programs can encrypt and decrypt
data, digitally sign documents and verify digital signatures, manage
(generate, list and delete) encryption keys, using proven Public Key
Infrastructure (PKI) encryption technology based on OpenPGP.

This module is expected to be used with Python versions = 2.4, as it
makes use of the subprocess module which appeared in that version of
Python. This module is a newer version derived from earlier work by
Andrew Kuchling, Richard Jones and Steve Traugott.

A test suite using unittest is included with the source distribution.

Simple usage:

 import gnupg
 gpg = gnupg.GPG(gnupghome='/path/to/keyring/directory')
 gpg.list_keys()
[{
  ...
  'fingerprint': 'F819EE7705497D73E3CCEE65197D5DAC68F1AAB2',
  'keyid': '197D5DAC68F1AAB2',
  'length': '1024',
  'type': 'pub',
  'uids': ['', 'Gary Gross (A test user) gary.gr...@gamma.com']},
 {
  ...
  'fingerprint': '37F24DD4B918CC264D4F31D60C5FEFA7A921FC4A',
  'keyid': '0C5FEFA7A921FC4A',
  'length': '1024',
  ...
  'uids': ['', 'Danny Davis (A test user) danny.da...@delta.com']}]
 encrypted = gpg.encrypt(Hello, world!, ['0C5FEFA7A921FC4A'])
 str(encrypted)
'-BEGIN PGP MESSAGE-\nVersion: GnuPG v1.4.9 (GNU/Linux)\n
\nhQIOA/6NHMDTXUwcEAf
...
-END PGP MESSAGE-\n'
 decrypted = gpg.decrypt(str(encrypted), passphrase='secret')
 str(decrypted)
'Hello, world!'
 signed = gpg.sign(Goodbye, world!, passphrase='secret')
 verified = gpg.verify(str(signed))
 print Verified if verified else Not verified
'Verified'

For more information, visit http://code.google.com/p/python-gnupg/ -
as always, your feedback is most welcome (especially bug reports,
patches and suggestions for improvement). Enjoy!

Cheers

Vinay Sajip
Red Dove Consultants Ltd.
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


ANN: PipeController v0.1 released: Python tool to experiment with simulating UNIX-style pipes

2012-09-01 Thread vasudevram

PipeController is a tool that I wrote to experiment with simulating simple, 
sequential, synchronous UNIX-style pipes in Python. It is the first release - 
v0.1.

Blog post about PipeController:

http://jugad2.blogspot.in/2012/08/pipecontroller-v01-released-simulating.html

The blog post gives some information about the design of PipeController and an 
example of how to use it.

Download PipeController:

http://dancingbison.com/unix-pipes.zip

I have not put any license information in the PipeController source code, but 
will be doing that, and it will be released under the New BSD license.

- Vasudev Ram
www.dancingbison.com
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


Re: PyTexas: last day for $25 registration, talk proposal

2012-09-01 Thread Brad Allen
Whoops, false alarm. Tomorrow, August 31 is actually the last day to
register and pay at the $25 rate for PyTexas. Likewise for talk
proposals.

On Thu, Aug 30, 2012 at 3:36 PM, Brad Allen bradallen...@gmail.com wrote:
 Just wanted to send out this quick reminder--today is the last day for
 PyTexas $25 registration; starting tomorrow it will cost $50.

 http://www.pytexas.org/chance/1/register/

 Today is also your last day to post your talk proposals.

 http://www.pytexas.org/chance/1/talks/add/

 Btw, there is going to be a PyTexas t-shirt given away with every
 registration. I've seen advance drafts which are beautiful, drawn and
 colored by Kat Metgzer, the same artist who did the PyTexas 2010
 t-shirt.  This evening after work I might be able to post the artwork
 on the PyTexas blog.
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


[ANN] guidata v1.5.0

2012-09-01 Thread Pierre.RAYBAUT
Hi all,

I am pleased to announce that `guidata` v1.5.0 has been released 
(http://guidata.googlecode.com).

Based on the Qt Python binding module PyQt4 (and mostly compatible with 
PySide), guidata is a Python library generating graphical user interfaces for 
easy dataset editing and display. It also provides helpers and application 
development tools for PyQt4.

guidata also provides the following features:
* guidata.qthelpers: PyQt4 helpers
* guidata.disthelpers: cx_Freeze/py2exe helpers (or how to build a 
self-consistent executable in three lines of code!)
* guidata.userconfig: .ini configuration management helpers (based on 
Python standard module ConfigParser)
* guidata.configtools: library/application data management
* guidata.gettext_helpers: translation helpers (based on the GNU tool 
gettext)
* guidata.guitest: automatic GUI-based test launcher
* guidata.utils: miscelleneous utilities

guidata has been successfully tested on GNU/Linux and Windows platforms.

This is mostly a maintenance release with a couple of bugfixes and minor new 
features (see changelog here: http://code.google.com/p/guidata/wiki/ChangeLog).

The Mercurial repository is now publicly available here:
http://code.google.com/p/guidata/source/checkout

The `guidata` documentation with examples, API reference, etc. is available 
here:
http://packages.python.org/guidata/

Python package index page:
http://pypi.python.org/pypi/guidata/

Documentation, screenshots:
http://packages.python.org/guidata/

Downloads (source + Windows installers):
http://guidata.googlecode.com

--
Dr. Pierre Raybaut
CEA - Commissariat à l'Energie Atomique et aux Energies Alternatives
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


[ANN] guiqwt v2.2.0

2012-09-01 Thread Pierre.RAYBAUT
Hi all,

I am pleased to announce that `guiqwt` v2.2.0 has been released 
(http://guiqwt.googlecode.com).

Based on PyQwt (plotting widgets for PyQt4 graphical user interfaces) and on 
the scientific modules NumPy and SciPy, guiqwt is a Python library providing 
efficient 2D data-plotting features (curve/image visualization and related 
tools) for interactive computing and signal/image processing application 
development.

The Mercurial repository is now publicly available here:
http://code.google.com/p/guiqwt/source/checkout

Complete change log is available here:
http://code.google.com/p/guiqwt/wiki/ChangeLog

Documentation with examples, API reference, etc. is available here:
http://packages.python.org/guiqwt/

This version of `guiqwt` includes a demo software, Sift (for Signal and Image 
Filtering Tool), based on `guidata` and `guiqwt`:
http://packages.python.org/guiqwt/sift.html
Windows users may even download the portable version of Sift 0.2.6 to test it 
without having to install anything:
http://code.google.com/p/guiqwt/downloads/detail?name=sift-0.2.6-guiqwt-2.2-win32.zip

When compared to the excellent module `matplotlib`, the main advantages of 
`guiqwt` are:
  * Performance: see 
http://packages.python.org/guiqwt/overview.html#performances
  * Interactivity: see for example 
http://packages.python.org/guiqwt/_images/plot.png
  * Powerful signal processing tools: see for example 
http://packages.python.org/guiqwt/_images/fit.png
  * Powerful image processing tools:
* Real-time contrast adjustment: 
http://packages.python.org/guiqwt/_images/contrast.png
* Cross sections (line/column, averaged and oblique cross sections!): 
http://packages.python.org/guiqwt/_images/cross_section.png
* Arbitrary affine transforms on images: 
http://packages.python.org/guiqwt/_images/transform.png
* Interactive filters: 
http://packages.python.org/guiqwt/_images/imagefilter.png
* Geometrical shapes/Measurement tools: 
http://packages.python.org/guiqwt/_images/image_plot_tools.png
* Perfect integration of `guidata` features for image data editing: 
http://packages.python.org/guiqwt/_images/simple_window.png


But `guiqwt` is more than a plotting library; it also provides:
  * Framework for signal/image processing application development: see 
http://packages.python.org/guiqwt/examples.html
  * And many other features like making executable Windows programs easily 
(py2exe helpers): see http://packages.python.org/guiqwt/disthelpers.html

guiqwt has been successfully tested on GNU/Linux and Windows platforms.

Python package index page:
http://pypi.python.org/pypi/guiqwt/

Documentation, screenshots:
http://packages.python.org/guiqwt/

Downloads (source + Python(x,y) plugin):
http://guiqwt.googlecode.com

--
Dr. Pierre Raybaut
CEA - Commissariat à l'Energie Atomique et aux Energies Alternatives
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


Twisted 12.2.0 released

2012-09-01 Thread Ashwini Oruganti
On behalf of Twisted Matrix Laboratories, I am honored to announce the
release of Twisted 12.2.

Highlights for this release include:

  * To be able to work on Python3 support, Python 2.5 is no longer
supported.

  * twisted.mail.imap4 now serves BODYSTRUCTURE responses which provide
more information and conform to the IMAP4 RFC more closely.

  * twisted.conch now supports commercial SSH implementations which don't
comply with the IETF standard.

  * twisted.internet.endpoints now provides several new endpoints,
including a
TCP client endpoint that resolves hostnames to IPv6 host addresses.

  * IReactorSocket.adoptStreamConnection, implemented by some reactors,
allows adding an existing established connection to the reactor.

Starting with the release after 12.2, Twisted will begin requiring
zope.interface 3.6 (as part of Python 3 support).

This is the last Twisted release supporting Python 2.6 on Windows.

For more information, see the NEWS file here:

 http://twistedmatrix.com/Releases/Twisted/12.2/NEWS.txt


Download it now from:

 http://pypi.python.org/packages/source/T/Twisted/Twisted-12.2.0.tar.bz2 or


http://pypi.python.org/packages/2.6/T/Twisted/Twisted-12.2.0.win32-py2.6.exe
 or


http://pypi.python.org/packages/2.6/T/Twisted/Twisted-12.2.0.win32-py2.6.msi
 or


http://pypi.python.org/packages/2.7/T/Twisted/Twisted-12.2.0.win32-py2.7.exe
 or


http://pypi.python.org/packages/2.7/T/Twisted/Twisted-12.2.0.win32-py2.7.msi


Thanks to the supporters of Twisted and to the many contributors for this
release.


--
Ashwini Oruganti
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


Re: why i can't set locale?

2012-09-01 Thread Peter Otten
contro opinion wrote:

 locale.setlocale(locale.LC_ALL, 'gbk')
 Traceback (most recent call last):
   File stdin, line 1, in module
   File /usr/lib/python2.6/locale.py, line 513, in setlocale
 return _setlocale(category, locale)
 locale.Error: unsupported locale setting

Try picking one of the locales listed by

$ locale -a

(Goggle suggests that you may be looking for zh_CN.GBK)

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


Re: how to get character hex number?

2012-09-01 Thread Peter Otten
Tim Chase wrote:

 On 08/31/12 22:41, contro opinion wrote:
 uenglish.encode(utf-8)
 'english'
 uenglish.encode(ascii)
 'english'

 how can i get 656e676c697368 in encode method?

 At least in 2.x, you can do:

   uenglish.encode(hex)
  '656e676c697368'

 how about in python3.0?
 
 Well, in 3.1.3 at least, using the u... notation dies on me with
 an invalid syntax.  However, as Ian suggests, you can do
 
   my_str = english
   .join(%02x % c for c in my_str.encode(ascii))
 
 or whatever other encoding you want instead of ascii.

Another option:

 binascii.hexlify(english.encode()).decode()
'656e676c697368'


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


Re: how to get character hex number?

2012-09-01 Thread Mark Lawrence

On 01/09/2012 04:50, Tim Chase wrote:


Well, in 3.1.3 at least, using the u... notation dies on me with
an invalid syntax.  However, as Ian suggests, you can do

   my_str = english
   .join(%02x % c for c in my_str.encode(ascii))

or whatever other encoding you want instead of ascii.

-tkc




The u... notation has been reintroducd for Python 3.3 see 
http://docs.python.org/dev/whatsnew/3.3.html#pep-414-explicit-unicode-literals


--
Cheers.

Mark Lawrence.

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


Re: Tkinter bug in Entry widgets on OS X

2012-09-01 Thread Arnaud Delobelle
On Friday, 31 August 2012, Dennis Lee Bieber wrote:

 On Fri, 31 Aug 2012 15:41:01 GMT, Alister 
 alister.w...@ntlworld.comjavascript:;
 
 declaimed the following in gmane.comp.python.general:

  I agree that it is unexpected in a single line entry box but isn't the
 1st
  rule of user interface design to assume the user is a moron  will do
  things they are not supposed to do?
 
  Therefore invalid inputs should be handled gracefully (not just insert
  random characters) which is what I think the original poster is
  suggesting.

 To which I'd suggest the programmer (vs the user), probably needs
 to
 code some sort of per-character validation check... After all, there may
 be situations where accepting pretty much any key-code is desired, and
 if the widget filters characters before they get to the programmer level
 that becomes impossible.


It would be good if I could intercept the key press event and cancel its
action on the Entry widget.  It's easy to intercept the key event, but I
haven't found out how to prevent the funny characters from being inserted
into the Entry widget input area.  I've struggled to find good tkinter docs
on the web.


 caveat -- I've only written one simple form using Tkinter, so what
 do I know...


It's about as much as I've done!

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


Re: Tkinter bug in Entry widgets on OS X

2012-09-01 Thread Peter Otten
Arnaud Delobelle wrote:

 On Friday, 31 August 2012, Dennis Lee Bieber wrote:
 
 On Fri, 31 Aug 2012 15:41:01 GMT, Alister
 alister.w...@ntlworld.comjavascript:;
 
 declaimed the following in gmane.comp.python.general:

  I agree that it is unexpected in a single line entry box but isn't the
 1st
  rule of user interface design to assume the user is a moron  will do
  things they are not supposed to do?
 
  Therefore invalid inputs should be handled gracefully (not just insert
  random characters) which is what I think the original poster is
  suggesting.

 To which I'd suggest the programmer (vs the user), probably needs
 to
 code some sort of per-character validation check... After all, there may
 be situations where accepting pretty much any key-code is desired, and
 if the widget filters characters before they get to the programmer level
 that becomes impossible.


 It would be good if I could intercept the key press event and cancel its
 action on the Entry widget.  It's easy to intercept the key event, but I
 haven't found out how to prevent the funny characters from being inserted
 into the Entry widget input area.  

Untested as I have no Mac:

import Tkinter as tk

def suppress(event):
if event.keycode in {111, 116}:
print ignoring, event.keycode
return break
print event.keycode, accepted

root = tk.Tk()
entry = tk.Entry(root)
entry.bind(Key, suppress)
entry.pack()

root.mainloop()

 I've struggled to find good tkinter
 docs on the web.

For my (basic) needs I keep coming back to

http://infohost.nmt.edu/tcc/help/pubs/tkinter/

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


Re: how to get character hex number?

2012-09-01 Thread Tim Chase
On 09/01/12 03:49, Mark Lawrence wrote:
 On 01/09/2012 04:50, Tim Chase wrote:
 Well, in 3.1.3 at least, using the u... notation dies on me with
 an invalid syntax.
 
 The u... notation has been reintroducd for Python 3.3

Nice to know--it makes writing backwards compat. code just a bit
easier, even if it is a NOOP.  I'll catch it when Debian Stable
makes it there (currently at 3.1).

-tkc


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


Re: to know binary

2012-09-01 Thread Laszlo Nagy

On 2012-09-01 06:15, contro opinion wrote:

there is a only line in the file nanmed test:
1234
when i open it whit  xxd
xxd  test
what i  get is :
000: 3132 3334 0a 1234.
can you explain it ?
At offset zero (00): chr(0x31) + chr(0x32)+ chr(0x33)+ chr(0x33)+ 
chr(0x0a) = '1'+'2'+'3'+'4'+'.' = '1234.'


Does it have to do ANYTHING with Python? If I were you, and it was 
something that must be explained, then I would rather start books about 
programming before asking questions on a mailing list that is not 
related to my question.

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


Re: Tkinter bug in Entry widgets on OS X

2012-09-01 Thread Arnaud Delobelle
On 1 September 2012 11:30, Peter Otten __pete...@web.de wrote:
 Arnaud Delobelle wrote:
 It would be good if I could intercept the key press event and cancel its
 action on the Entry widget.  It's easy to intercept the key event, but I
 haven't found out how to prevent the funny characters from being inserted
 into the Entry widget input area.

 Untested as I have no Mac:

 import Tkinter as tk

 def suppress(event):
 if event.keycode in {111, 116}:
 print ignoring, event.keycode
 return break
 print event.keycode, accepted

 root = tk.Tk()
 entry = tk.Entry(root)
 entry.bind(Key, suppress)
 entry.pack()

 root.mainloop()

This works fine!

return break is the piece of knowledge that I was missing. Thanks a
lot!  In fact I lied a bit in my original message - I do use the UP
and DOWN arrows on one Entry widget for navigating its command
history. To do this I was binding the Up and Down events to a
function, which simply has to return break to work around the bug.
On other Entry widgets, I just bind Up and Down to a suppress
function which simply returns break.

 I've struggled to find good tkinter
 docs on the web.

 For my (basic) needs I keep coming back to

 http://infohost.nmt.edu/tcc/help/pubs/tkinter/

Thanks for the link.  I was using the docs on effbot which are nice
but probably incomplete (and old).

I guess I should flag up this bug but I don't even know if it's a
Python or Tk problem and have little time or expertise to investigate.

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


Re: Looking for an IPC solution

2012-09-01 Thread Wolfgang Keller
 There are just so many IPC modules out there. I'm looking for a
 solution for developing a new a multi-tier application. The core
 application will be running on a single computer, so the IPC should
 be using shared memory (or mmap) and have very short response times.

Probably the fastest I/RPC implementation for Python should be
OmniOrbpy:

http://omniorb.sourceforge.net/

It's cross-platform, language-independent and standard-(Corba-)
compliant.

 I have seen a stand alone cross platform IPC server before that could 
 serve channels, and send/receive messages using these channels. But
 I don't remember its name and now I cannot find it. Can somebody
 please help?

If it's just for messaging, Spread should be interesting:

http://www.spread.org/ 

Also cross-platform  language-independent.

Sincerely,

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


Twisted 12.2.0 released

2012-09-01 Thread Ashwini Oruganti
On behalf of Twisted Matrix Laboratories, I am honored to announce the
release of Twisted 12.2.

Highlights for this release include:

  * To be able to work on Python3 support, Python 2.5 is no longer
supported.

  * twisted.mail.imap4 now serves BODYSTRUCTURE responses which provide
more information and conform to the IMAP4 RFC more closely.

  * twisted.conch now supports commercial SSH implementations which don't
comply with the IETF standard.

  * twisted.internet.endpoints now provides several new endpoints,
including a
TCP client endpoint that resolves hostnames to IPv6 host addresses.

  * IReactorSocket.adoptStreamConnection, implemented by some reactors,
allows adding an existing established connection to the reactor.

Starting with the release after 12.2, Twisted will begin requiring
zope.interface 3.6 (as part of Python 3 support).

This is the last Twisted release supporting Python 2.6 on Windows.

For more information, see the NEWS file here:

 http://twistedmatrix.com/Releases/Twisted/12.2/NEWS.txt


Download it now from:

 http://pypi.python.org/packages/source/T/Twisted/Twisted-12.2.0.tar.bz2 or


http://pypi.python.org/packages/2.6/T/Twisted/Twisted-12.2.0.win32-py2.6.exe
 or


http://pypi.python.org/packages/2.6/T/Twisted/Twisted-12.2.0.win32-py2.6.msi
 or


http://pypi.python.org/packages/2.7/T/Twisted/Twisted-12.2.0.win32-py2.7.exe
 or


http://pypi.python.org/packages/2.7/T/Twisted/Twisted-12.2.0.win32-py2.7.msi


Thanks to the supporters of Twisted and to the many contributors for this
release.


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


Re: interfacing with x86_64 assembler

2012-09-01 Thread Ramchandra Apte
On Friday, 31 August 2012 19:28:11 UTC+5:30, Grant Edwards  wrote:
 On 2012-08-31, Mark Lawrence breamore...@yahoo.co.uk wrote:
 
  On 31/08/2012 14:40, lipska the kat wrote:
 
 
 
  I was hacking away at some x86_64 assembler today
 
  when I found myself obsessively indenting my code
 
  by EXACTLY 4 spaces or (multiples thereof)
 
 
 
  What's wrong with structured assembler? :)
 
 
 
 Nothing -- it's called C.
 
 
 
 -- 
 
 Grant Edwards   grant.b.edwardsYow! Not SENSUOUS ... only
 
   at   FROLICSOME ... and in
 
   gmail.comneed of DENTAL WORK ... in
 
PAIN!!!

Very much true. In fact C is by definition assembly (as the creators just added 
whatever features the machine supported to C)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PipeController v0.1 - experimental tool to simulate simple UNIX-style pipes in Python

2012-09-01 Thread Ramchandra Apte
On Friday, 31 August 2012 03:27:54 UTC+5:30, vasudevram  wrote:
 I wrote PipeController recently to experiment with doing UNIX-style pipes in 
 Python.
 
 
 
 Blog post about it:
 
 
 
 http://jugad2.blogspot.in/2012/08/pipecontroller-v01-released-simulating.html
 
 
 
 The blog post has a link to the downloadable PipeController source code.
 
 
 
 It will be released under the New BSD License, which means you can use it for 
 any purpose, commercial or otherwise, subject to the terms of the license.
 
 
 
 - Vasudev Ram
 
 www.dancingbison.com
 
 jugad2.blogspot.com
 
 twitter.com/vasudevram

Doesn't the pipes module already do this?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: KAJOL SEX VIDEOS'''''''''''''''''''

2012-09-01 Thread raipervaiz786
On Thursday, August 2, 2012 9:35:25 PM UTC+5, devi wrote:
 KAJAL SEX VIDEOS
 
 http://maxworkerds.co.cc

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


Re: Async client for PostgreSQL?

2012-09-01 Thread Werner Thie

On 8/31/12 7:17 PM, Laszlo Nagy wrote:

Is there any extension for Python that can do async I/O for PostgreSQL
with tornadoweb's ioloop?

Something like:

class MainHandler(tornado.web.RequestHandler):
 @tornado.web.asynchronous
 def get(self):
 pg_connection.(long_taking_query_sql,params,callback=self.on_query_opened)

 def on_query_opened(self, query):
 self.write(process_rows(query))
 self.finish()



What would be an alternative?

The theoretical problem: suppose there are 100 clients (web browsers)
connected to the server with keep alive connections. They are doing
long-polls and they are also sending/receiving events (with short
response times). Each web browser has an associated state stored on the
server side, in the memory (as an object tree). The state is bound to
the client with a session id. Most requests will have to be responded
with small amounts of data, calculated from the session state, or
queried from the database. Most database queries are simple, running for
about 100msec. But a few of them will run for 1sec or more. Number of
requests ending in database queries is relatively low (10/sec). Other
requests can be responded must faster.  but they are much more frequent
(100/sec, that is. 1 request/sec/client).  There is a big global cache
full of (Python) objects. Their purpose is to reduce the number of
database queries. These objects in the global cache are emitting events
to other objects found in the client sessions. Generally, it is not
possible to tell what request will end in a database query.

Multi-threading is not an option because number of clients is too high
(running 100 threads is not good). This is why I decided to use anyc
I/O. Tornadoweb looks good for most requirements: async i/o, store
session state in objects etc. The biggest problem is that psycopg is not
compatible with this model. If I use blocking I/O calls inside a request
handler, then they will block all other requests most of the time,
resulting in slow response times.

What would be a good solution for this?

Thanks,

Laszlo



Hi

does running on tornado imply that you would not consider twisted 
http://twistedmatrix.com ?


If not, twisted has exactly this capability hiding long running queries 
on whatever db's behind deferToThread().


Brute force I would pack the db access into a twisted run web-service, 
forking work out in twisted either with deferToThread() or if you want 
to take advantage of using processes instead of threads thus being able 
to tap all cores, then have a look at ampoule at 
https://launchpad.net/ampoule - be aware though that ampoule has a 64k 
limit on what can be passed around.


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


Re: PipeController v0.1 - experimental tool to simulate simple UNIX-style pipes in Python

2012-09-01 Thread Ian Kelly
Resending to the list...
On Sep 1, 2012 12:19 PM, Ian Kelly ian.g.ke...@gmail.com wrote:

 On Sep 1, 2012 9:37 AM, Ramchandra Apte maniandra...@gmail.com wrote:
  Doesn't the pipes module already do this?

 No, that deals with actual Unix pipes. This appears to be about pipelined
 processing within a single program and not IPC; the description Unix-like
 is a bit misleading, IMO.

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


Re: Async client for PostgreSQL?

2012-09-01 Thread Laszlo Nagy



Hi

does running on tornado imply that you would not consider twisted 
http://twistedmatrix.com ?


If not, twisted has exactly this capability hiding long running 
queries on whatever db's behind deferToThread().

All right, I was reading its documentation

http://twistedmatrix.com/documents/10.1.0/api/twisted.internet.threads.deferToThread.html

It doesn't tell too much about it: Run a function in a thread and 
return the result as a Deferred..


Run a function but in what thread? Does it create a new thread for every 
invocation? In that case, I don't want to use this. My example case: 10% 
from 100 requests/second deal with a database. But it does not mean that 
one db-related request will do a single db API call only. They will 
almost always do more: start transaction, parse and open query, fetch 
with cursor, close query, open another query etc. then commit 
transaction. 8 API calls to do a quick fetch + update (usually under 
100msec, but it might be blocked by another transaction for a while...) 
So we are talking about 80 database API calls per seconds at least. It 
would be insane to initialize a new thread for each invocation. And 
wrapping these API calls into a single closure function is not useful 
either, because that function would not be able to safely access the 
state that is stored in the main thread. Unless you protet it with 
locks. But it is whole point of async I/O server: to avoid using slow 
locks, expensive threads and context switching.


Maybe, deferToThread uses a thread pool? But it doesn't say much about 
it. (Am I reading the wrong documentation?) BTW I could try a version 
that uses a thread pool.


It is sad, by the way. We have async I/O servers for Python that can be 
used for large number of clients, but most external modules/extensions 
do not support their I/O loops. Including the extension modules of the 
most popular databases. So yes, you can use Twisted or torandoweb until 
you do not want to call *some* API functions that are blocking. (By 
*some* I mean: much less blocking than non-blocking, but quite a few.) 
We also have synchronous Python servers, but we cannot get rid of the 
GIL, Python threads are expensive and slow, so they cannot be used for a 
large number of clients. And finally, we have messaging services/IPC 
like zeromq. They are probably the most expensive, but they scale very 
well. But you need more money to operate the underlying hardware. I'm 
starting to think that I did not get a quick answer because my use case 
(100 clients) fall into to the heavy weight category, and the solution 
is to invest more in the hardware. :-)


Thanks,

   Laszlo

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


Re: Async client for PostgreSQL?

2012-09-01 Thread Werner Thie

On 9/1/12 9:28 AM, Laszlo Nagy wrote:



Hi

does running on tornado imply that you would not consider twisted
http://twistedmatrix.com ?

If not, twisted has exactly this capability hiding long running
queries on whatever db's behind deferToThread().

All right, I was reading its documentation

http://twistedmatrix.com/documents/10.1.0/api/twisted.internet.threads.deferToThread.html


It doesn't tell too much about it: Run a function in a thread and
return the result as a Deferred..

Run a function but in what thread? Does it create a new thread for every
invocation? In that case, I don't want to use this. My example case: 10%
from 100 requests/second deal with a database. But it does not mean that
one db-related request will do a single db API call only. They will
almost always do more: start transaction, parse and open query, fetch
with cursor, close query, open another query etc. then commit
transaction. 8 API calls to do a quick fetch + update (usually under
100msec, but it might be blocked by another transaction for a while...)
So we are talking about 80 database API calls per seconds at least. It
would be insane to initialize a new thread for each invocation. And
wrapping these API calls into a single closure function is not useful
either, because that function would not be able to safely access the
state that is stored in the main thread. Unless you protet it with
locks. But it is whole point of async I/O server: to avoid using slow
locks, expensive threads and context switching.

Maybe, deferToThread uses a thread pool? But it doesn't say much about
it. (Am I reading the wrong documentation?) BTW I could try a version
that uses a thread pool.

It is sad, by the way. We have async I/O servers for Python that can be
used for large number of clients, but most external modules/extensions
do not support their I/O loops. Including the extension modules of the
most popular databases. So yes, you can use Twisted or torandoweb until
you do not want to call *some* API functions that are blocking. (By
*some* I mean: much less blocking than non-blocking, but quite a few.)
We also have synchronous Python servers, but we cannot get rid of the
GIL, Python threads are expensive and slow, so they cannot be used for a
large number of clients. And finally, we have messaging services/IPC
like zeromq. They are probably the most expensive, but they scale very
well. But you need more money to operate the underlying hardware. I'm
starting to think that I did not get a quick answer because my use case
(100 clients) fall into to the heavy weight category, and the solution
is to invest more in the hardware. :-)

Thanks,

Laszlo



Laszlo:

Hmm, I was suggesting that you could replace the whole DB driver with a 
webservice implemented with twisted, if you rule out threads then with 
ampoule doing it with a process pool and consume this webservice with 
the tornado side asynchronously.


production level example thread pool based DB API:
Just to give you some ballpark figures, I'm running a game server with a 
daily peak of about 1500 parallel permanent connections and 50k games 
played every day (avg game duration 13min, peak request frequency close 
to 100req/sec) with a lot of statistics going into a MySQL DB on US$2k 
worth of hardware. Twisted as basis sitting atop FreeBSD, started the 
latest version in March, its running since then, no restarts, no 
reboots, no problems.


production level example process pool based PDF production:
Or for another implementation I'm running a webservice based PDF 
production (probably as blocking as services can come) for a Java based 
business app with twisted/ampoule, this is as stable as the game server.


HTH, Werner

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


Re: Async client for PostgreSQL?

2012-09-01 Thread jwp
On Friday, August 31, 2012 10:17:18 PM UTC-7, Laszlo Nagy wrote:
 Is there any extension for Python that can do async I/O for PostgreSQL 

As others point out, the easiest route is using one of the blocking drivers 
with threads and emulate async operations.

However, the low-level parts of py-postgresql (python.projects.postgresql.org) 
were designed with arbitrary modes in mind. That is, the protocol code is 
independent of the transport so that it could be used with frameworks like 
twisted given some effort. Much of the work that will go into py-postgresql 
over the next couple years will be to make it easier to integrate into 
arbitrary frameworks. Currently, I suspect it would require some heavy 
lifting.. =\

cheers,

github.com/jwp
-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: A new version (0.3.1) of the Python module which wraps GnuPG has been released.

2012-09-01 Thread Vinay Sajip
A new version of the Python module which wraps GnuPG has been
released.

What Changed?
=
This is a minor enhancement and bug-fix release. See the project
website ( http://code.google.com/p/python-gnupg/ ) for more
information. Summary:

Better support for status messages from GnuPG.
Support for additional arguments to be passed to GnuPG.
Bugs in tests which used Latin-1 encoded data have been fixed by
specifying that encoding.
On verification (including after decryption), the signer trust level
is returned in integer and text formats.

The current version passes all tests on Windows (CPython 2.4, 2.5,
2.6, 2.7, 3.1 and Jython 2.5.1), Mac OS X (Python 2.5) and Ubuntu
(CPython 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2). On Windows, GnuPG 1.4.11
has been used for the tests.

What Does It Do?

The gnupg module allows Python programs to make use of the
functionality provided by the Gnu Privacy Guard (abbreviated GPG or
GnuPG). Using this module, Python programs can encrypt and decrypt
data, digitally sign documents and verify digital signatures, manage
(generate, list and delete) encryption keys, using proven Public Key
Infrastructure (PKI) encryption technology based on OpenPGP.

This module is expected to be used with Python versions = 2.4, as it
makes use of the subprocess module which appeared in that version of
Python. This module is a newer version derived from earlier work by
Andrew Kuchling, Richard Jones and Steve Traugott.

A test suite using unittest is included with the source distribution.

Simple usage:

 import gnupg
 gpg = gnupg.GPG(gnupghome='/path/to/keyring/directory')
 gpg.list_keys()
[{
  ...
  'fingerprint': 'F819EE7705497D73E3CCEE65197D5DAC68F1AAB2',
  'keyid': '197D5DAC68F1AAB2',
  'length': '1024',
  'type': 'pub',
  'uids': ['', 'Gary Gross (A test user) gary.gr...@gamma.com']},
 {
  ...
  'fingerprint': '37F24DD4B918CC264D4F31D60C5FEFA7A921FC4A',
  'keyid': '0C5FEFA7A921FC4A',
  'length': '1024',
  ...
  'uids': ['', 'Danny Davis (A test user) danny.da...@delta.com']}]
 encrypted = gpg.encrypt(Hello, world!, ['0C5FEFA7A921FC4A'])
 str(encrypted)
'-BEGIN PGP MESSAGE-\nVersion: GnuPG v1.4.9 (GNU/Linux)\n
\nhQIOA/6NHMDTXUwcEAf
...
-END PGP MESSAGE-\n'
 decrypted = gpg.decrypt(str(encrypted), passphrase='secret')
 str(decrypted)
'Hello, world!'
 signed = gpg.sign(Goodbye, world!, passphrase='secret')
 verified = gpg.verify(str(signed))
 print Verified if verified else Not verified
'Verified'

For more information, visit http://code.google.com/p/python-gnupg/ -
as always, your feedback is most welcome (especially bug reports,
patches and suggestions for improvement). Enjoy!

Cheers

Vinay Sajip
Red Dove Consultants Ltd.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: interfacing with x86_64 assembler

2012-09-01 Thread John Ladasky
I haven't seen this joke on the Net in years, does anyone still remember it?

C combines the power of assembly language with the readability and 
maintainability of assembly language.

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


Re: interfacing with x86_64 assembler

2012-09-01 Thread Chris Angelico
On Sun, Sep 2, 2012 at 10:10 AM, John Ladasky
john_lada...@sbcglobal.net wrote:
 I haven't seen this joke on the Net in years, does anyone still remember it?

 C combines the power of assembly language with the readability and 
 maintainability of assembly language.

Seen it, and it has validity. But I'd rather work with C than actual
assembly any day. And these days, C code is just a bunch of directives
specifying how a compiler should build a program; optimizing compilers
add, remove, reorder, whatever they think fit. It's a pretty high
level language now.

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


Re: Looking for an IPC solution

2012-09-01 Thread Aaron Brady
On Friday, August 31, 2012 2:22:00 PM UTC-5, Laszlo Nagy wrote:
 There are just so many IPC modules out there. I'm looking for a solution 
 
 for developing a new a multi-tier application. The core application will 
 
 be running on a single computer, so the IPC should be using shared 
 
 memory (or mmap) and have very short response times. But there will be a 
 
 tier that will hold application state for clients, and there will be 
 
 lots of clients. So that tier needs to go to different computers. E.g. 
 
 the same IPC should also be accessed over TCP/IP. Most messages will be 
 
 simple data structures, nothing complicated. The ability to run on PyPy 
 
 would, and also to run on both Windows and Linux would be a plus.
 
 
 
 I have seen a stand alone cross platform IPC server before that could 
 
 serve channels, and send/receive messages using these channels. But I 
 
 don't remember its name and now I cannot find it. Can somebody please help?
 
 
 
 Thanks,
 
 
 
 Laszlo

Hi Laszlo,

There aren't a lot of ways to create a Python object in an mmap buffer.  
mmap is conducive to arrays of arrays.  For variable-length structures like 
strings and lists, you need dynamic allocation.  The C functions malloc and 
free allocate memory space, and file creation and deletion routines operate 
on disk space.  However malloc doesn't allow you to allocate memory space 
within memory that's already allocated.  Operating systems don't provide that 
capability, and doing it yourself amounts to creating your own file system.  If 
you did, you still might not be able to use existing libraries like the STL or 
Python, because one address might refer to different locations in different 
processes.

One solution is to keep a linked list of free blocks within your mmap buffer. 
 It is prone to slow access times and segment fragmentation.  Another solution 
is to create many small files with fixed-length names.  The minimum file size 
on your system might become prohibitive depending on your constraints, since a 
4-byte integer could occupy 4096 bytes on disk or more.  Or you can serialize 
the arguments and return values of your functions, and make requests to a 
central process.
-- 
http://mail.python.org/mailman/listinfo/python-list


Accessing AST at runtime

2012-09-01 Thread alessandromoura35
Hi,

I would like to access the AST of a python object at runtime. I mean, if I have 
this:

def f(x): return x*x/2

Is there any way to interrogate the object f to find out the AST of the 
expression x*x/2 ? Of course if the definition of f were in a file, I could use 
the ast module to parse it; but what I want is to do this from within the code.

The closest thing I was able to find was f.__code__, and more specifically 
f.__code__.co_code, but that is a byte-string which seems to be the bytecode 
(?) for the function.

This may not be possible at all; maybe after the def statement is processed by 
the Python interpreter the AST information is discarded. But I wanted to check 
here if someone knows one way or another.

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


Re: Accessing AST at runtime

2012-09-01 Thread Ramchandra Apte
On Sunday, 2 September 2012 08:00:59 UTC+5:30, (unknown)  wrote:
 Hi,
 
 
 
 I would like to access the AST of a python object at runtime. I mean, if I 
 have this:
 
 
 
 def f(x): return x*x/2
 
 
 
 Is there any way to interrogate the object f to find out the AST of the 
 expression x*x/2 ? Of course if the definition of f were in a file, I could 
 use the ast module to parse it; but what I want is to do this from within the 
 code.
 
 
 
 The closest thing I was able to find was f.__code__, and more specifically 
 f.__code__.co_code, but that is a byte-string which seems to be the bytecode 
 (?) for the function.
 
 
 
 This may not be possible at all; maybe after the def statement is processed 
 by the Python interpreter the AST information is discarded. But I wanted to 
 check here if someone knows one way or another.
 
 
 
 Many thanks.

You could scan the text for code and then ast.parse() it.
Then you know how...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: interfacing with x86_64 assembler

2012-09-01 Thread Ramchandra Apte
On Sunday, 2 September 2012 06:06:06 UTC+5:30, Chris Angelico  wrote:
 On Sun, Sep 2, 2012 at 10:10 AM, John Ladasky
 
 john_lada...@sbcglobal.net wrote:
 
  I haven't seen this joke on the Net in years, does anyone still remember it?
 
 
 
  C combines the power of assembly language with the readability and 
  maintainability of assembly language.
 
 
 
 Seen it, and it has validity. But I'd rather work with C than actual
 
 assembly any day. And these days, C code is just a bunch of directives
 
 specifying how a compiler should build a program; optimizing compilers
 
 add, remove, reorder, whatever they think fit. It's a pretty high
 
 level language now.
 
 
 
 ChrisA

I thought it was like this:
assembly a low level language
C a medium level language
Java a high level language
Python a very-high level language
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: py2c - an open source Python to C/C++ is looking for developers

2012-09-01 Thread Ramchandra Apte
On Tuesday, 31 July 2012 18:16:27 UTC+5:30, Stefan Behnel  wrote:
 Stefan Behnel, 31.07.2012 07:23:
 
  From a look at the source code, it seems hard to bring it together with
 
  anything. It looks very monolithic.
 
 
 
 Hmm, sorry, I mixed it up with 2c.py, which is yet another of those
 
 Python-to-C compilers with an all too similar name.
 
 
 
 https://code.google.com/p/2c-python/
 
 
 
 There are a couple of others here:
 
 
 
 http://wiki.python.org/moin/PythonImplementations
 
 
 
 Seeing the number of those compilers, almost none of which is commonly used
 
 and/or still alive as a project, the question really is: why another one?
 
 
 
 I mean, it's totally fine as a hobby educational project, sure, and I
 
 really don't want to discourage anyone from going through this to have fun.
 
 
 
 But apart from just for fun, what is the goal that would make this
 
 particular compiler different from the others? And also different enough to
 
 merit its own source base, instead of basing it on one of the existing
 
 projects? I don't consider source is harder to read than to write a good
 
 answer to this in general.

 
 
 Stefan

It converts to *pure* C/C++ *without* using Python or its API so that it can be 
the same speed as C/C++
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Curses unicode support

2012-09-01 Thread cjgohlke
On Saturday, September 1, 2012 3:41:04 PM UTC-7, Steven D'Aprano wrote:
 Thanks to Victor Stinner, the curses module now has improved Unicode 
 
 support.
 
 
 
 http://mail.python.org/pipermail/python-dev/2012-September/121569.html
 
 
 
 Victor has asked for testers to report any bugs in the module before 
 
 Python 3.3 goes live:
 
 
 
 [quote]
 
 So please try to test the curses module before Python 3.3 final with
 
 your favorite application!
 
 [end quote]
 
 
 
 
 
 -- 
 
 Steven

It might be worth mentioning here that there is no _curses module, with or 
without Unicode support, in any CPython version for the Windows operating 
system (http://bugs.python.org/issue2889).

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


Re: py2c - an open source Python to C/C++ is looking for developers

2012-09-01 Thread Michael Torrie
On 09/01/2012 09:15 PM, Ramchandra Apte wrote:
 It converts to *pure* C/C++ *without* using Python or its API so that it can 
 be the same speed as C/C++

Sounds like a fun project for you.  I hope you learn a lot doing it.
That's reason enough for it.  Do you plan to port all the standard
python modules as well, though?  Because Python modules, both in the
standard library and third-party, are the main reasons that I use
python.  For example, PyGTK.  Python is a great glue language.  Since it
can seamlessly interact with C and be extended in C, speed has never
really been an issue for me.

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


[issue15821] PyMemoryView_FromBuffer() behavior change (possible regression)

2012-09-01 Thread Stefan Krah

Stefan Krah added the comment:

In general, the number of calls to PyObject_GetBuffer() must be equal to
the number of calls to PyBuffer_Release(), otherwise bad things will happen
in the same way as with malloc()/free().


Now, in my test case I omitted the call to PyObject_GetBuffer() *with*
the internal knowledge that in the case of the bytes object it does
not matter: The releasebufferproc is NULL, so PyBuffer_Release()
is just a way of decrementing the reference count of the bytes object.


No matter how you turn it, if info.obj != NULL you need some internal
knowledge what the obj's releasebufferproc will do. For example, I
suspect that many existing releasebufferprocs do not account for
the fact that a consumer may change shape, strides and suboffsets.

So you need to know the exporter really well.


My strategy here is this: I want to keep backwards compatibility
for PyMemoryView_FromBuffer(), which I think should be deprecated
at some point.


A proper function that returns a memoryview with automatic cleanup
would not involve getbuffer/releasebuffer at all and could look like
this:

Flags:
--
PyManagedBuffer_FreeBuf
PyManagedBuffer_FreeFormat
PyManagedBuffer_FreeArrays  // shape, strides, suboffsets

PyMemoryView_FromBufferWithCleanup(info, flags)
{
/* info should never have been obtained by a call to PyObject_GetBuffer().
   Hence it should never be released. */
assert(info.obj == NULL);

/* buf, format, shape, strides and suboffsets MUST stay valid
   for the lifetime of the returned memoryview. Usually they
   will be dynamically allocated using PyMem_Malloc(). This is
   no problem, since there is automatic cleanup in mbuf_dealloc(). */

mbuf = mbuf_alloc();
mbuf-master = *info;
mbuf-flags |= flags;

...

return new memoryview
}

mbuf_dealloc(self)
{
if (self-flagsPyManagedBuffer_FreeBuf)
PyMem_Free(self-master.buf);
...
}

This is much more flexible than the existing function and does not suffer
from any abuse of getbuffer/releasebuffer.

--

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



[issue15837] Added test to test_random.py testing Random.shuffle

2012-09-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 The int=int is probably some sort of micro-optimization and perhaps should be 
 removed.

Agree, this micro-optimization has no effect here.

--
nosy: +storchaka

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



[issue15837] Added test to test_random.py testing Random.shuffle

2012-09-01 Thread Alessandro Moura

Alessandro Moura added the comment:

Sorry, here it is the patch.

--
keywords: +patch
Added file: http://bugs.python.org/file27082/random.patch

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



[issue14783] Make int() and str() docstrings correct

2012-09-01 Thread Ezio Melotti

Ezio Melotti added the comment:

The issues about weird signatures are being discussed on #15831.

 However, this issue is about the docstring. Leave it incorrect?
 Change it to the hard-to-parse one liner? Change it to a 
 two-line signature also?

For the docstring it's ok to use the double signature too.  The description, 
while not too comprehensive, is understandable.
The description of int() in the docs is instead a bit complicated.  The content 
is good, but IMHO it would be more understandable if it was broken down into 
paragraphs or into a list.

--

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



[issue15826] Increased test coverage of test_glob.py

2012-09-01 Thread Alessandro Moura

Alessandro Moura added the comment:

test_bytes_glob_directory_with_trailing_slash already has a counterpart in the 
main class, but it is not easily handled by overriding self.glob and self.norm. 
Since it is only a single test, I just decided to override 
test_glob_directory_with_trailing_slash from the main class. But looking at 
this now I realize that I actually created another method with a different name 
by mistake; so the attached patch changes that.

--
Added file: http://bugs.python.org/file27083/test_glob.patch

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



[issue14042] json.dumps() documentation is slightly incorrect.

2012-09-01 Thread Petri Lehtinen

Petri Lehtinen added the comment:

Fixed, see #13769.

--

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



[issue15822] installed python may fail incorrectly trying to rebuild lib2to3 grammar pickles

2012-09-01 Thread Ned Deily

Ned Deily added the comment:

The problem here is in the libinstall Makefile target and that hidden 
dependency within lib2to3 that, as Tomi notes, causes lib2to3 to try to 
recreate the pickles anytime it runs if it thinks they are out of date.  The 
fixes for Issue15645 cause the recipes for that target to create the two 
grammar pickles in the source Lib directory before files are copied and 
installed into the destination lib directories. But there is no guarantee that 
the source files, Grammar.txt and PatternGrammar.txt, are installed into the 
destination lib before the corresponding pickle files are.  
lib2to3/pgen2/driver compares the value of os.path.getmtime() for the txt and 
pickle files (assuming both exist).  On many (most) file systems, the copies 
happen fast enough and the resolution of getmtime is coarse enough that the 
files are created with the same time value so post-installation use of lib2to3 
works OK. But on file systems like ext4 with high-resolution time values, it 
may happen that one or both o
 f the pickle files is copied first and ends up with a slightly older time 
value than its corresponding txt file.  In that case the first use of lib2to3 
will try to recreate the pickle which will most likely fail with a file 
permission error since the install directories are typically read-only to 
non-root users.

The attached patch tries to work around around the problem by touching the two 
pickle files after they and all the other relevant lib files have been 
installed.

Since any user could run into this problem on the right configuration, I think 
the fix (assuming reviewers concur with it) should be cherry-picked for 
3.3.0rc2.

--
components: +Installation
keywords: +patch
nosy: +ronaldoussoren
priority: high - release blocker
stage:  - patch review
title: Python 3.3 creates lib2to3 grammar in wrong order - installed python 
may fail incorrectly trying to rebuild lib2to3 grammar pickles
versions: +Python 2.7, Python 3.2
Added file: http://bugs.python.org/file27084/issue15822_33.patch

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



[issue15748] Various symlink test failures in test_shutil on FreeBSD

2012-09-01 Thread Trent Nelson

Trent Nelson added the comment:

Not really... the problem is that the chmod 0007 actually corrupts the ZFS 
metadata regarding the symlink by always setting the length to 24.

Andriy did some debugging here: 
http://lists.freebsd.org/pipermail/freebsd-fs/2012-August/015005.html

So, the link basically becomes invalid once the bug hits.

Here's another option I just thought of: change the tests to use something 
other than 0007, then add another test specifically for this issue.

--

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



[issue15802] Nonsensical test for mailbox

2012-09-01 Thread Petri Lehtinen

Petri Lehtinen added the comment:

Techincally, converting to int is not necessary, because the number of digits 
in the unix timestamp doesn't change until year 2286 :)

The patch looks good to me. I don't think comparing pairs would be any more 
readable than what the proposed patch does.

--
assignee:  - petri.lehtinen
stage:  - commit review

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



[issue15814] memoryview: equality-hash invariant

2012-09-01 Thread Stefan Krah

Stefan Krah added the comment:

Here's a patch that enforces byte formats.


Does everyone agree on (or tolerate at least) allowing 'B', 'b' and 'c'?
I think we should at least commit the doc patch for 3.3.0. Otherwise
implementors of exporting objects might waste time on a feature that's
deprecated.

--
Added file: http://bugs.python.org/file27085/issue15814-2.diff

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



[issue15838] make install tries to create lib2to3 grammar pickles in source directory

2012-09-01 Thread Ned Deily

New submission from Ned Deily:

With the recent activity around making out-of-tree builds work, while 
investigating Issue15822 I realized that the lib2to3 grammar pickle files are 
being built in the source directory by the libinstall target step of the main 
Makefile rather than in the build directory or just in the install location.  
The fixes for Issue15645 moved the pickle building to the start of the target 
recipes:

libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
$(PYTHON_FOR_BUILD) -Wi -c import lib2to3.pygram, 
lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()


On reflection, I think the PYTHONPATH definition is bogus here since LIBDEST is 
populated immediately after this step. More importantly, 
lib2to3/pgen2/driver:load_grammar ends up writing the pickle files into the 
source directory.  Unlike some other cases in the Makefile, if the source 
directory is read-only, the failure to create the pickle files is not an error 
during installation but it may likely cause problems for later users of the 
installed lib2to3 (like in the Issue15822 scenario), i.e. when the missing 
pickles are attempted to be created in the read-only install directories.

--
components: 2to3 (2.x to 3.x conversion tool), Build, Installation
messages: 169623
nosy: benjamin.peterson, ned.deily, ronaldoussoren, trent
priority: normal
severity: normal
stage: needs patch
status: open
title: make install tries to create lib2to3 grammar pickles in source directory
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

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



[issue15802] Nonsensical test for mailbox

2012-09-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset aef4a2ba3210 by Petri Lehtinen in branch '3.2':
#15802: Fix test logic in TestMaildir.test_create_tmp
http://hg.python.org/cpython/rev/aef4a2ba3210

New changeset 2370e331241b by Petri Lehtinen in branch '2.7':
#15802: Fix test logic in TestMaildir.test_create_tmp
http://hg.python.org/cpython/rev/2370e331241b

New changeset e2fec0144bf8 by Petri Lehtinen in branch 'default':
#15802: Fix test logic in TestMaildir.test_create_tmp
http://hg.python.org/cpython/rev/e2fec0144bf8

--
nosy: +python-dev

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



[issue15802] Nonsensical test for mailbox

2012-09-01 Thread Petri Lehtinen

Petri Lehtinen added the comment:

Fixed, thanks.

--
resolution:  - fixed
stage: commit review - committed/rejected
status: open - closed

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



[issue15814] memoryview: equality-hash invariant

2012-09-01 Thread Nick Coghlan

Nick Coghlan added the comment:

+1 for docs patch for 3.3.0 and then enforcing the format restriction for 3.3.1.

--

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



[issue15795] Zipfile.extractall does not preserve file permissions

2012-09-01 Thread Alexey Boriskin

Changes by Alexey Boriskin sun.v...@gmail.com:


--
hgrepos: +147

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



[issue15814] memoryview: equality-hash invariant

2012-09-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 895e123d9476 by Stefan Krah in branch 'default':
Issue #15814: Document planned restrictions for memoryview hashes in 3.3.1.
http://hg.python.org/cpython/rev/895e123d9476

--
nosy: +python-dev

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



[issue14223] curses addch broken on Python3.3a1

2012-09-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 27b5bd5f0e4c by Victor Stinner in branch 'default':
Close #14223: Fix window.addch(curses.ACS_HLINE)
http://hg.python.org/cpython/rev/27b5bd5f0e4c

--
resolution:  - fixed
status: open - closed

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



[issue15795] Zipfile.extractall does not preserve file permissions

2012-09-01 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
hgrepos:  -147

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



[issue15795] Zipfile.extractall does not preserve file permissions

2012-09-01 Thread Alexey Boriskin

Alexey Boriskin added the comment:

I'm attaching a patch, which solves the issue. Patch intoduces new argument 
preserve_permissions for extract and extractall methods. That argument may 
accept one of the three values: do not preserve permissions, preserve a safe 
subset of them or preserve all permissions. Three constants introduced for 
these options. Patch also contains test and docs. Tests pass for me on OS X 
10.5, but I'm not sure if they'll pass on other operating systems.

--
keywords: +patch
Added file: http://bugs.python.org/file27086/issue15795.patch

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



[issue14223] curses addch broken on Python3.3a1

2012-09-01 Thread STINNER Victor

STINNER Victor added the comment:

 I'm reopening this bug because I've noticed that in Python3.3rc1,
 although trying to print curses.ACS_HLINE and other such characters
 no long cause an Exception, only blank characters are printed to
 the screen.

If the Python curses module is compiled in Unicode mode (if curses.unget_wch() 
is present), addch(int) calls the C function wadd_wch() or mvwadd_wch(), 
instead of waddch() or mvwaddch(). It looks like the *_wch() family does not 
support characters like curses.ACS_HLINE.

My commit fixes the issue.

@Nicholas.Cole: Can you please try the last development version (default 
branch)?

@georg.brandl: Can you please include the important fix 27b5bd5f0e4c in Python 
3.3 final?

--
nosy: +georg.brandl

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



[issue14223] curses addch broken on Python3.3a1

2012-09-01 Thread STINNER Victor

STINNER Victor added the comment:

(keep the issue open until the fix is included in Georg's repository)

--
resolution: fixed - 
status: closed - open

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



[issue15785] curses.get_wch() returns keypad codes incorrectly

2012-09-01 Thread STINNER Victor

STINNER Victor added the comment:

@georg.brandl: Can you please include the important fix c58789634d22 into 
Python 3.3 final?

--

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



[issue15814] memoryview: equality-hash invariant

2012-09-01 Thread Martin v . Löwis

Martin v. Löwis added the comment:

Am 01.09.12 13:22, schrieb Stefan Krah:
 Does everyone agree on (or tolerate at least) allowing 'B', 'b' and 'c'?

Why be more permissive than necessary? -0 on the committed version;
it should IMO further restrict it to 1D contiguous byte arrays.

--

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



[issue15839] SystemError raised by super() should be NameError or RuntimeError

2012-09-01 Thread Ramchandra Apte

New submission from Ramchandra Apte:

Running the erronous code:

class X:
super_object = super()

fails with a SystemError(super(): __class__ cell not found)
The exception should be a NameError or SystemError.

--
components: None
messages: 169634
nosy: ramchandra.apte
priority: normal
severity: normal
status: open
title: SystemError raised by super() should be NameError or RuntimeError
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3

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



[issue15839] SystemError raised by super() in erronous class should be NameError or RuntimeError

2012-09-01 Thread Ramchandra Apte

Changes by Ramchandra Apte maniandra...@gmail.com:


--
title: SystemError raised by super() should be NameError or RuntimeError - 
SystemError raised by super() in erronous class should be NameError or 
RuntimeError

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



[issue15599] test_circular_imports() of test_threaded_import fails on FreeBSD 9.0

2012-09-01 Thread Stefan Krah

Stefan Krah added the comment:

The FreeBSD machine decided to hang for 1h:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%203.x/builds/3340/steps/test/logs/stdio


If I'm running the tests manually, they take over half an hour and I get:

==
FAIL: test_parallel_meta_path (test.test_threaded_import.ThreadedImportTests)
--
Traceback (most recent call last):
  File /usr/home/stefan/cpython/Lib/test/test_threaded_import.py, line 133, 
in test_parallel_meta_path
self.assertEqual(finder.x, finder.numcalls)
AssertionError: 41 != 42

--
Ran 6 tests in 2090.042s


[I hope this is not a threading bug in FreeBSD that appears under
high load.]

--

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



[issue15814] memoryview: equality-hash invariant

2012-09-01 Thread Stefan Krah

Stefan Krah added the comment:

Martin v. L??wis rep...@bugs.python.org wrote:
 Why be more permissive than necessary? -0 on the committed version;
 it should IMO further restrict it to 1D contiguous byte arrays.

Does byte arrays include 'b' and 'c' or just 'B'? I don't see a reason 
to allow 'B' but not the others.


I'm +-0 on allowing multi-dimensional arrays, but it would be
odd to restrict hashing to contiguous arrays:

 b = b'abcdefhhijkl'
 m = memoryview(b)
 b[::-1]
b'lkjihhfedcba'
 bytes(m[::-1]) 
b'lkjihhfedcba'
 hash(b[::-1]) == hash(m[::-1])
True


My reasoning was: If non-contiguous arrays are allowed (and I think they
should be), why not allow multi-dimensional arrays, too?


The definition hash(m) == hash(m.tobytes()) is pretty straightforward.

--

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



[issue15599] test_circular_imports() of test_threaded_import fails on FreeBSD 9.0

2012-09-01 Thread Stefan Krah

Stefan Krah added the comment:

I see that in the following build test_threading also fails, so I
wouldn't spend too much time on debugging test_threaded_import:

 ==
FAIL: test_waitfor_timeout (test.test_threading.ConditionTests)
--
Traceback (most recent call last):
  File 
/usr/home/buildbot/buildarea/3.x.krah-freebsd/build/Lib/test/lock_tests.py, 
line 531, in test_waitfor_timeout
self.assertEqual(len(success), 1)
AssertionError: 0 != 1

--

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



[issue15814] memoryview: equality-hash invariant

2012-09-01 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

On Sep 1, 2012, at 10:24 AM, Stefan Krah rep...@bugs.python.org wrote:

 
 The definition hash(m) == hash(m.tobytes()) is pretty straightforward.

I probably missed something from the early discussion, but doesn't this 
definition only work for 1d (or 0d) views? Shouldn't shape come into 
calculation for multidimensional views?

--
nosy: +Alexander.Belopolsky

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



[issue15599] test_circular_imports() of test_threaded_import fails on FreeBSD 9.0

2012-09-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 I see that in the following build test_threading also fails, so I
 wouldn't spend too much time on debugging test_threaded_import:

Did something change recently on that machine? It's supposed to be a
stable buildbot.

--

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



[issue15599] test_circular_imports() of test_threaded_import fails on FreeBSD 9.0

2012-09-01 Thread Stefan Krah

Stefan Krah added the comment:

Nothing changed on the buildbot. -- It appears that FreeBSD is unable to
handle the low switchinterval. With the patch test_threaded_import runs in
10s.


Since Linux has no problems whatsoever, I'm inclined to think that's
a FreeBSD issue.


I've yet to check if the other problem in test_threading is related.

--
keywords: +patch
Added file: http://bugs.python.org/file27087/issue15599.diff

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



[issue15814] memoryview: equality-hash invariant

2012-09-01 Thread Stefan Krah

Stefan Krah added the comment:

tobytes() is the same as the flattened multi-dimensional list representation
with all elements converted to bytes. If I'm not mistaken, that's how NumPy's
tostring() behaves.

--

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



[issue15814] memoryview: equality-hash invariant

2012-09-01 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

On Sep 1, 2012, at 11:06 AM, Stefan Krah rep...@bugs.python.org wrote:

 tobytes() is the same as the flattened multi-dimensional list representation
 with all elements converted to bytes.

This is correct, but why is it desirable to have deliberate hash collisions 
between views with different shapes?

--

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



[issue15814] memoryview: equality-hash invariant

2012-09-01 Thread Nick Coghlan

Nick Coghlan added the comment:

Keep in mind that its OK if hash(m) == hash(m.tobytes()) in some cases where m 
!= m.tobytes(). The only cases we really need to kill are those that break the 
hash invariant.

I don't like the idea of making the definition of hash more complicated just to 
rule out cases that aren't actually broken.

--

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



[issue15814] memoryview: equality-hash invariant

2012-09-01 Thread Stefan Krah

Stefan Krah added the comment:

 why is it desirable to have deliberate hash collisions between views with 
 different shapes?

Since we're now restricting everything to bytes, the multi-dimensional case
is probably not useful at all. As I said above, I would leave it in because
it actually saves one check for ndim and as Nick said, the definition is
simpler. Now the user only has to remember that hashing works for 'B', 'b'
and 'c'.

--

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



[issue15814] memoryview: equality-hash invariant

2012-09-01 Thread Martin v . Löwis

Martin v. Löwis added the comment:

Am 01.09.12 16:24, schrieb Stefan Krah:
 Does byte arrays include 'b' and 'c' or just 'B'? I don't see a reason
 to allow 'B' but not the others.

Either type is fine with me. It's the multi-dimensional aspect I'd like
to ban.

 My reasoning was: If non-contiguous arrays are allowed (and I think they
 should be), why not allow multi-dimensional arrays, too?

I think neither should be allowed. The explicit request (from Antoine)
was that memoryviews of bytes objects should be hashable. I haven't
heard anybody asking for something more general (but I could see that
people want to hash other memory blocks as well, such as mmap views).

I can see that it is tempting to provide the most general definition,
but see where this approach got us. It's always easier to widen an
interface later than to narrow it.

--

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



[issue15523] Block on close TCP socket in SocketServer.py

2012-09-01 Thread Charles-François Natali

Charles-François Natali added the comment:

 So when calling close_request to deallocate the socket, it will 
 always be waiting to read response until response data is available. 
 It seems like an issue in SokcetServer.py library.

Hum, I don't see what you mean.
Even if there is still data in the receive socket buffer, socket.clos() 
shouldn't block. Actually, it should result in a RST being sent.
Could you describe your problem more precisely (with a code snippet it would be 
better)?

--
nosy: +neologix

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



[issue15831] comma after leading optional argument is after bracket in docs

2012-09-01 Thread Georg Brandl

Georg Brandl added the comment:

+1 for multiple signatures.

--

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



[issue15814] memoryview: equality-hash invariant

2012-09-01 Thread Stefan Krah

Stefan Krah added the comment:

Disallowing non-contiguous arrays leads to very strange situations though.
I'm positive that there will be a bug report about this:

 x = memoryview(b'abc')[::-1]
 b = b'cba'
 d = {b'cba': 101}
 
 b in d
True
 x == b
True
 x in d
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: memoryiew: hashing is restricted to C-contiguous arrays

Could we perhaps take a small poll? My own vote is:

1) Allow bytes hashing at all: +0.5

2) If 1) is allowed, then also non-contiguous hashing is allowed: +1

3) Allow multi-dimensional hashing: +-0

--

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



[issue15831] comma after leading optional argument is after bracket in docs

2012-09-01 Thread Chris Jerdonek

Chris Jerdonek added the comment:

 (The double signature might be easier to understand, but the original issue 
 should probably be fixed in Sphinx, even if we decide to stop using this kind 
 of signature.)

I filed an issue for this in the Sphinx tracker here:

https://bitbucket.org/birkenfeld/sphinx/issue/1001/comma-after-leading-optional-argument-in

--

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



[issue14385] Support other types than dict for __builtins__

2012-09-01 Thread Martijn Pieters

Martijn Pieters added the comment:

I note that the documentation still states a dictionary is required for 
globals. Should that not be updated as well?

See http://docs.python.org/py3k/library/functions.html#exec

--
nosy: +mjpieters

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



[issue14385] Support other types than dict for __builtins__

2012-09-01 Thread Martijn Pieters

Martijn Pieters added the comment:

Apologies, I meant to link to the dev docs:

  http://docs.python.org/dev/library/functions.html#exec

--

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



[issue15831] comma after leading optional argument is after bracket in docs

2012-09-01 Thread Chris Jerdonek

Chris Jerdonek added the comment:

I will prepare a patch (multiple signatures, for the Python fix).

--

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



[issue15836] unittest assertRaises should verify excClass is actually a BaseException class

2012-09-01 Thread Michael Foord

Michael Foord added the comment:

Yep, certainly worth fixing. When 3.3 is out the door I will look at applying 
this to all branches.

--

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



[issue15814] memoryview: equality-hash invariant

2012-09-01 Thread Martin v . Löwis

Martin v. Löwis added the comment:

Am 01.09.12 19:20, schrieb Stefan Krah:
 Disallowing non-contiguous arrays leads to very strange situations though.

I don't find that strange. That two object compare equal doesn't imply
that they both hash - only that *if* they hash, they should hash equal.

In any case, this can happen already:

py x = memoryview(array.array('B',b'cba'))
py b = b'cba'
py d = {b'cba': 101}
py b in d
True
py x == b
True
py x in d
Traceback (most recent call last):
   File stdin, line 1, in module
ValueError: cannot hash writable memoryview object

It can also happen with other types (although I had to look around
a bit):

py x=set((1,2,3))
py b=frozenset(x)
py d={b:101}
py b in d
True
py x==b
True
py x in d
Traceback (most recent call last):
   File stdin, line 1, in module
TypeError: unhashable type: 'set'

 1) Allow bytes hashing at all: +0.5

+0

 2) If 1) is allowed, then also non-contiguous hashing is allowed: +1

-1

 3) Allow multi-dimensional hashing: +-0

-1

--

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



[issue15836] unittest assertRaises should verify excClass is actually a BaseException class

2012-09-01 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

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



[issue11866] race condition in threading._newname()

2012-09-01 Thread Charles-François Natali

Changes by Charles-François Natali neolo...@free.fr:


--
stage:  - commit review

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



[issue15814] memoryview: equality-hash invariant

2012-09-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Could we perhaps take a small poll? My own vote is:
 
 1) Allow bytes hashing at all: +0.5

+10. The buffer() object in 2.x was hashable, and a very important use
case of memoryview is replacing buffer().

 2) If 1) is allowed, then also non-contiguous hashing is allowed: +1
 3) Allow multi-dimensional hashing: +-0

I don't care about these. I kind of agree with Martin that hashability
should be motivated by an use case, so -0.

--

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



[issue11866] race condition in threading._newname()

2012-09-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

With or without Raymond's suggested change, global _counter is not necessary 
anymore.
Note that this fix only works on implementations where itertools.count().next 
is atomic.

--

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



[issue15814] memoryview: equality-hash invariant

2012-09-01 Thread Stefan Krah

Stefan Krah added the comment:

 py x = memoryview(array.array('B',b'cba'))

I find the array example is different. The user has to remember one thing:
memoryviews based on arrays don't hash.

For memoryviews based on bytes one would have to remember:

  - 'B', 'c' and 'b' hash

  - only C-contiguous arrays hash

  - b'abc'[::-1] hashes, but memoryview(b'abc')[::-1] does not

--

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



[issue15836] unittest assertRaises should verify excClass is actually a BaseException class

2012-09-01 Thread R. David Murray

R. David Murray added the comment:

Since it is a bugfix it can be applied at any time now.  Checkins to default 
will end up in 3.3.1 and 3.4.  (Only features need to wait until after 3.3 is 
branched in the main repo.)

--

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



[issue15814] memoryview: equality-hash invariant

2012-09-01 Thread Martin v . Löwis

Martin v. Löwis added the comment:

Am 01.09.12 20:06, schrieb Stefan Krah:
- b'abc'[::-1] hashes, but memoryview(b'abc')[::-1] does not

I find that memoryview(b'abc')[::-1] is a strange thing to have,
anyway, so I'm not bothered by it behaving different. I can accept
that it needs to be supported for consistency, but I would recommend
against using it in applications. Who needs reversed memory, anyway?
The only case were I ever needed reversal is lists (typically sorted,
perhaps cronological).

--

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



[issue15840] Ambiguity with regard to the effect of accessing a closed IOBase instance

2012-09-01 Thread Alexander Konovalenko

New submission from Alexander Konovalenko:

Two pieces of the documentation for io.IOBase seem to contradict each other:

At http://docs.python.org/library/io.html#io.IOBase:
Note that calling any method (even inquiries) on a closed stream is undefined. 
Implementations may raise IOError in this case.

At http://docs.python.org/library/io.html#io.IOBase.close:
Once the file is closed, any operation on the file (e.g. reading or writing) 
will raise a ValueError.

Perhaps the confusion arises in part because it is not clear when a requirement 
for all IOBase implementations is documented and when the docs merely describe 
the default behavior of IOBase that implementations are free to override.

Those passages are inconsistent on two points:

1) IOError and ValueError are not subclasses one of another. So what should we 
expect an IOBase implementation to raise?

2) Undefined behavior means literally anything can happen. Technically, that 
means calling read() or readable() on a closed file (or other kind of stream) 
could wreak havoc in a totally unrelated part of the system or segfault the 
Python interpreter. That is definitely a thing to carefully avoid in any 
production systems.

On the other hand, raising an exception, even if we don't know in advance 
whether it will be ValueError or IOError, is pretty much defined behavior. An 
exception is easy to deal with and to contain inside a module.

So please clarify how dangerous it actually is to access an IOBase stream after 
it has been closed.

--
assignee: docs@python
components: Documentation
messages: 169660
nosy: alexkon, docs@python
priority: normal
severity: normal
status: open
title: Ambiguity with regard to the effect of accessing a closed IOBase instance
versions: Python 2.7

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



[issue15599] test_circular_imports() of test_threaded_import fails on FreeBSD 9.0

2012-09-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Since Linux has no problems whatsoever, I'm inclined to think that's
 a FreeBSD issue.

Maybe. If you believe it's so, I guess the patch can be committed.

--

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



[issue1528167] Tweak to make string.Templates more customizable

2012-09-01 Thread R. David Murray

R. David Murray added the comment:

I don't think this closure was appropriate.  The idea was accepted twice and 
argued against once, so it isn't dead (it's just resting).

--
assignee: barry - 
nosy: +r.david.murray
resolution: wont fix - 
status: closed - open
versions: +Python 3.4 -Python 3.2

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



[issue15840] Ambiguity with regard to the effect of accessing a closed IOBase instance

2012-09-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 1) IOError and ValueError are not subclasses one of another. So what
 should we expect an IOBase implementation to raise?

Ideally, ValueError should be raised, but I suspect some methods raise IOError 
instead.

 Undefined behavior means literally anything can happen.

In practice, it will either raise an error, or be ignored. For example, calling 
close() a second time would be ignored. Calling readable() may return the 
original value (before the file was closed), etc.

Any non-trivial behaviour should be reported as a bug, though. Especially, 
reading or writing methods (read(), write(), readline() etc.) should *never* 
succeed on a closed file.

--
components: +IO
nosy: +pitrou
stage:  - needs patch
versions: +Python 3.2, Python 3.3

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



[issue15840] Ambiguity with regard to the effect of accessing a closed IOBase instance

2012-09-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Actually, I would suggest we standardize the docs on raising ValueError as the 
official behaviour, and fix non-compliant behaviours as bugs.

--

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



[issue15841] Some StringIO and BytesIO methods can succeed after close

2012-09-01 Thread Antoine Pitrou

New submission from Antoine Pitrou:

 f = io.StringIO()
 f.close()
 f.readable()
True
 f.read()
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: I/O operation on closed file.

 f = io.BytesIO()
 f.close()
 f.readable()
True
 f.read()
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: I/O operation on closed file

--
components: IO, Library (Lib)
messages: 169665
nosy: pitrou
priority: normal
severity: normal
status: open
title: Some StringIO and BytesIO methods can succeed after close
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3

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



[issue15841] Some StringIO and BytesIO methods can succeed after close

2012-09-01 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +benjamin.peterson, hynek, stutzbach

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



[issue15840] Ambiguity with regard to the effect of accessing a closed IOBase instance

2012-09-01 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +benjamin.peterson, hynek, stutzbach

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



[issue15842] Some SocketIO methods can succeed after close()

2012-09-01 Thread Antoine Pitrou

New submission from Antoine Pitrou:

 import socket
 s = socket.socket()
 f = s.makefile(rb, buffering=0)
 f
socket.SocketIO object at 0x7f2f323cd790
 f.close()
 f.writable()
False
 f.readable()
False

--
components: IO, Library (Lib)
messages: 169666
nosy: benjamin.peterson, hynek, pitrou, stutzbach
priority: normal
severity: normal
status: open
title: Some SocketIO methods can succeed after close()
type: behavior
versions: Python 3.2, Python 3.3

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



[issue15840] Ambiguity with regard to the effect of accessing a closed IOBase instance

2012-09-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Related: issue15841 and issue15842.

--

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



  1   2   >