Re: Packages whith “except” overwriting builtins

2012-05-28 Thread Jakub Wilk
Context: 
http://docs.python.org/whatsnew/2.6.html#pep-3110-exception-handling-changes


* Paul Wise , 2010-08-03, 17:47:
What about adding a lintian warning about this? Could file a bug about 
that?


In the mean time, I implemented such check in lintian4python.

Results for slightly out-of-date sid are attached.

--
Jakub Wilk
A Mennucc1 
   python-freevo (U)

Adam Cécile (Le_Vert) 
   hellanzb

Alessio Treglia 
   idjc (U)

Alexandre Fayolle 
   spambayes (U)

Andreas Rottmann 
   python-crypto (U)

Andreas Tille 
   mgltools-molkit (U)
   python-cogent (U)

Andrew O. Shadura 
   twms

Antonio Valentino 
   python-tables (U)

Arnaud Quette 
   moovida-plugins-ugly (U)

Calendarserver Maintainers 
   python-vobject

Chris Lamb 
   python-django-treebeard
   rst2pdf

Chris Silva 
   scribes

Christine Spang 
   quodlibet-plugins (U)

Clint Adams 
   python-django-pagination

Cristian Greco 
   deluge-common
   deluge-gtk

Debian freesmartphone.org Team 
   fso-frameworkd

Debian Games Team 
   magicor

Debian Med Packaging Team 
   mgltools-molkit
   python-cogent

Debian Multimedia Maintainers 

   idjc

Debian Python Modules Team 
   ipython
   python-crypto (U)
   python-enable
   python-igraph
   python-pebl

Debian Science Maintainers 
   python-tables

Debian SSSD Team 
   python-sss

Erik Wenzel 
   dynagen

Free Ekanayaka 
   idjc (U)
   python-twisted-core (U)

Freevo Debian Dream Team 
   python-freevo

Georg W. Leonhardt 
   python-freevo (U)

Guido Günther 
   python-vobject (U)

Jeremy Malcolm 
   gozerbot

Jeremy Sanders 
   veusz (U)

Joachim Breitner 
   fso-frameworkd (U)

Jose Carlos Garcia Sogo 
   conduit

Julian Taylor 
   ipython (U)

Julien Danjou 
   hyde

Laszlo Boszormenyi (GCS) 
   python-turbogears2

Loic Minier 
   moovida-plugins-ugly (U)

Luca Capello 
   fso-frameworkd (U)

Ludovico Cavedon 
   tortoisehg

Luke Faraone 
   turtleart (U)

Maintainers of GStreamer packages 

   moovida-plugins-ugly

Matthew Gallagher 
   turtleart

Matthias Klose 
   python-twisted-core
   qmtest

Max Bowsher 
   tortoisehg (U)

Michael Hanke 
   python-nibabel (U)

Miriam Ruiz 
   python-pebl (U)

NeuroDebian Team 
   python-nibabel

Ondřej Kuzník 
   quodlibet-plugins

Paul van Tilburg 
   moovida-plugins-ugly (U)

Philipp Kern 
   python-pydhcplib

Pierre Chifflier 
   dff

Python Applications Packaging Team 
   scribes (U)
   spambayes
   veusz

Reinhard Tartler 
   idjc (U)

Rico Rommel 
   fso-frameworkd (U)

Sargis Dallakyan 
   mgltools-molkit (U)

Sebastian Ramacher 
   python-crypto

Sebastian Reichel 
   fso-frameworkd (U)

Steffen Moeller 
   mgltools-molkit (U)
   python-cogent (U)

Stephan Peijnik 
   ipython (U)

TANIGUCHI Takaki 
   python-igraph (U)

Thorsten Alteholz 
   mgltools-molkit (U)

Timo Aaltonen 
   python-sss (U)

Varun Hiremath 
   python-enable (U)

Vincent Cheng 
   magicor (U)

Yaroslav Halchenko 
   python-nibabel (U)
   python-pebl (U)
   python-tables (U)



Re: Packages whith “except” overwriting builtins

2010-08-09 Thread Paul Wise
On Wed, Aug 4, 2010 at 12:20 PM, Jakub Wilk  wrote:

> I checked only for built-in exception names, which should cover most cases.
> A simple regex like:

Thanks.

> Also, feel free to file a bug against lintian. :)

Done (#592379). This will probably end up as a wishlist against
pyflakes and a pyflakes test for lintian extras.

-- 
bye,
pabs

http://wiki.debian.org/PaulWise


-- 
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/aanlktikypwsynwurn47noguwptbmzzy1rwbgoxefu...@mail.gmail.com



Re: Packages whith ???except??? overwriting builtins

2010-08-08 Thread Toni Mueller


Hi Jakub,

thanks for taking the effort to tour the code!

On Tue, 03.08.2010 at 19:18:27 +0200, Jakub Wilk  wrote:
> Toni Mueller 
>roundup

should be fixed in 1.4.15-2, just uploaded.


Kind regards,
--Toni++


-- 
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20100808161555.4610.qm...@oak.oeko.net



Re: Packages whith “except ” overwriting builtins

2010-08-04 Thread Jakub Wilk

* Tristan Seligmann , 2010-08-04, 04:50:

You might be easily mislead into thinking that this code

...

will catch both IOError and OSError exceptions. In fact, it will not, as it
is more or less equivalent to:

...

There are about 50 packages in the archive whose developers make this kind
of mistake. I have attached log file and dd-list. I'm not willing to do MBF,
but if someone else is, please feel free to use my data.


What about adding a lintian warning about this? Could file a bug about that?


How would you implement the warning? There's no way to easily tell
whether a given name is an existing class name or not.


I checked only for built-in exception names, which should cover most 
cases. A simple regex like:


^\s*except\s+[\w.]+\s*,\s*((?:Base)?Exception|(?:Arithmetic|Assertion|Attribute|Buffer|EOF|Environment|FloatingPoint|IO|Import|Indentation|Index|Key|Lookup|Memory|Name|NotImplemented|OS|Overflow|Reference|Runtime|Standard|Syntax|System|Tab|Type|UnboundLocal|UnicodeDecode|UnicodeEncode|Unicode|UnicodeTranslate|Value|ZeroDivision)Error|(?:Generator|System)Exit|(?:Bytes|Deprecation|Future|Import|Overflow|PendingDeprecation|Runtime|Syntax|Unicode|User)?Warning|StopIteration|KeyboardInterrupt)\s*:

should do the trick.

Also, feel free to file a bug against lintian. :)

--
Jakub Wilk


signature.asc
Description: Digital signature


Re: Packages whith “except” overwriting builtins

2010-08-04 Thread Barry Warsaw
On Aug 04, 2010, at 03:21 PM, Jakub Wilk wrote:

>* Paul Wise , 2010-08-04, 08:31:
>>> There are pychecker, pyflakes, and pylint in Debian.
>>> This specific case raises a warning in pylint, if I'm not mistaken.
>>
>>Thanks for the info, I've added these package names to the
>>DebianMentorsNet wiki page listing feature wishlists for
>>mentors.debian.net/lintian-extras.
>
>Frankly, I find none of these suitable for running automatic checks:
>- pychecker doesn't support some syntax constructs (#577070);
>- signal/noise ratio of pylint is close to zero;
>- pyflakes looks promising, but doesn't even detect the bug we are
>currently discussing.

None really are, at least not on their own, and not for an automated
gatekeeper without heavy hacking.  They can be useful tools, but I've never
seen any moderately complex bit of Python code ever be completely clean.  It
would be difficult to get one configuration that could be used across the
board.

-Barry


signature.asc
Description: PGP signature


Re: Packages whith “except ” overwriting builtins

2010-08-04 Thread Jakub Wilk

* Paul Wise , 2010-08-04, 08:31:

There are pychecker, pyflakes, and pylint in Debian.
This specific case raises a warning in pylint, if I'm not mistaken.


Thanks for the info, I've added these package names to the
DebianMentorsNet wiki page listing feature wishlists for
mentors.debian.net/lintian-extras.


Frankly, I find none of these suitable for running automatic checks:
- pychecker doesn't support some syntax constructs (#577070);
- signal/noise ratio of pylint is close to zero;
- pyflakes looks promising, but doesn't even detect the bug we are 
currently discussing.


--
Jakub Wilk


signature.asc
Description: Digital signature


Re: Packages whith “except” overwriting builtins

2010-08-04 Thread Paul Wise
On Wed, Aug 4, 2010 at 3:43 AM, W. Martin Borgert  wrote:

> There are pychecker, pyflakes, and pylint in Debian.
> This specific case raises a warning in pylint, if I'm not mistaken.

Thanks for the info, I've added these package names to the
DebianMentorsNet wiki page listing feature wishlists for
mentors.debian.net/lintian-extras.

-- 
bye,
pabs

http://wiki.debian.org/PaulWise


-- 
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/aanlktim83r9v3ekuwqrk1bkrn9rxhmhpchsw2q=ky...@mail.gmail.com



Re: Packages whith “except” overwriting builtins

2010-08-04 Thread W. Martin Borgert

Quoting "Paul Wise" :

Actually, is there any generalised syntax, language, deprecation and
mistake checker for python?


There are pychecker, pyflakes, and pylint in Debian.
This specific case raises a warning in pylint, if I'm not mistaken.


--
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/20100804094337.14326kdf30lj3...@webmail.in-berlin.de



Re: Packages whith “except” overwriting builtins

2010-08-03 Thread Paul Wise
On Tue, Aug 3, 2010 at 10:50 PM, Tristan Seligmann
 wrote:

> How would you implement the warning? There's no way to easily tell
> whether a given name is an existing class name or not.

Using whatever method Jakub used to create his list, if it is
implementable in perl that is.

Actually, is there any generalised syntax, language, deprecation and
mistake checker for python?

-- 
bye,
pabs

http://wiki.debian.org/PaulWise


-- 
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/aanlktikky-8masnztum_2obd6c9wmhehbe0dj16d5...@mail.gmail.com



Re: Packages whith “except” overwriting builtins

2010-08-03 Thread Tristan Seligmann
On Tue, Aug 3, 2010 at 11:47 PM, Paul Wise  wrote:
> 2010/8/3 Jakub Wilk :
>> You might be easily mislead into thinking that this code
> ...
>> will catch both IOError and OSError exceptions. In fact, it will not, as it
>> is more or less equivalent to:
> ...
>> There are about 50 packages in the archive whose developers make this kind
>> of mistake. I have attached log file and dd-list. I'm not willing to do MBF,
>> but if someone else is, please feel free to use my data.
>
> What about adding a lintian warning about this? Could file a bug about that?

How would you implement the warning? There's no way to easily tell
whether a given name is an existing class name or not.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar


-- 
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/aanlkti=yak15r9do2f4_jotcgswsyiydy4v8rvd-z...@mail.gmail.com



Re: Packages whith “except” overwriting builtins

2010-08-03 Thread Paul Wise
2010/8/3 Jakub Wilk :
> You might be easily mislead into thinking that this code
...
> will catch both IOError and OSError exceptions. In fact, it will not, as it
> is more or less equivalent to:
...
> There are about 50 packages in the archive whose developers make this kind
> of mistake. I have attached log file and dd-list. I'm not willing to do MBF,
> but if someone else is, please feel free to use my data.

What about adding a lintian warning about this? Could file a bug about that?

-- 
bye,
pabs

http://wiki.debian.org/PaulWise


-- 
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/aanlktikuyt7zfxe-huedxyo7j-0+wecvjfrbqsj5m...@mail.gmail.com



Re: Packages whith “except” overwriting builtins

2010-08-03 Thread Sandro Tosi
Hi Jakub,

2010/8/3 Jakub Wilk :
> You might be easily mislead into thinking that this code
>
>   try:
>      eggs()
>   except IOError, OSError:
>      pass
>
> will catch both IOError and OSError exceptions. In fact, it will not, as it
> is more or less equivalent to:
>
>   try:
>      eggs()
>   except IOError, ex:
>      OSError = ex  # Whoo, overwrite the built-in name

Just a reference to how properly catch them:
http://docs.python.org/tutorial/errors.html#handling-exceptions

> Sandro Tosi 
>   python-reportbug (U)

Fixed at 85174c0: thanks!

Regards,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi


--
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/aanlktincubg=0wu8rtdhazgcvufsycwopqt1-idns...@mail.gmail.com



Re: Packages whith “except ” overwriting builtins

2010-08-03 Thread Yaroslav Halchenko
Thank you Jakub!

I believe that quick resolution which could be recommended is
instead of
>except IOError, OSError:
having then grouped in a tuple
>except (IOError, OSError):

-- 
  .-.
=--   /v\  =
Keep in touch// \\ (yoh@|www.)onerussian.com
Yaroslav Halchenko  /(   )\   ICQ#: 60653192
   Linux User^^-^^[17]



-- 
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20100803173231.gy16...@onerussian.com



Packages whith “except ” overwriting builtins

2010-08-03 Thread Jakub Wilk

You might be easily mislead into thinking that this code

   try:
  eggs()
   except IOError, OSError:
  pass

will catch both IOError and OSError exceptions. In fact, it will not, as 
it is more or less equivalent to:


   try:
  eggs()
   except IOError, ex:
  OSError = ex  # Whoo, overwrite the built-in name

There are about 50 packages in the archive whose developers make this 
kind of mistake. I have attached log file and dd-list. I'm not willing 
to do MBF, but if someone else is, please feel free to use my data.


--
Jakub Wilk
Adam Cécile (Le_Vert) 
   hellanzb

Tim Abbott 
   sagemath

Rahul Amaram 
   python-twisted-calendarserver
   python-twisted-calendarserver (U)

David Andel 
   uligo

Kumar Appaiah 
   harvestman (U)

Luciano Bello 
   w3af-console

Bastian Blank 
   xen-utils-4.0 (U)

Andreas Bombe 
   anki

Joachim Breitner 
   fso-frameworkd (U)

Luca Bruno 
   uzbl (U)

Calendarserver Maintainers 
   python-vobject

Luca Capello 
   fso-frameworkd (U)

Sargis Dallakyan 
   mgltools-molkit (U)

Julien Danjou 
   mbot
   xen-utils-4.0 (U)

Debian freesmartphone.org Team 
   fso-frameworkd

Debian Multimedia Maintainers 

   idjc

Debian Python Modules Team 
   python-apptools
   python-enable
   python-nose (U)

Debian Xen Team 
   xen-utils-4.0

Debian-Med Packaging Team 
   mgltools-molkit

Sebastian Dröge 
   pitivi (U)

Free Ekanayaka 
   idjc (U)
   python-twisted-core (U)

Alexandre Fayolle 
   spambayes

Devid Antonio Filoni 
   emesene (U)

Morten Werner Forsbring 
   python-sss (U)

Freevo Debian Dream Team 
   python-freevo

Cristian Greco 
   deluge-common
   deluge-gtk

Guido Günther 
   python-vobject (U)

Wen Heping 
   python-tables

Varun Hiremath 
   python-apptools (U)
   python-enable (U)

Philipp Huebner 
   anyremote2html
   ganyremote
   kanyremote

Philipp Kern 
   python-pydhcplib

Julian Andres Klode 
   python-aptdaemon

Matthias Klose 
   python-twisted-core
   qmtest

Ondřej Kuzník 
   quodlibet-plugins (U)

Chris Lamb 
   python-django-treebeard
   rst2pdf

Chris Lawrence 
   python-reportbug (U)

Thomas Leonard 
   zeroinstall-injector

Georg W. Leonhardt 
   python-freevo (U)

Maintainers of GStreamer packages 

   moovida-plugins-ugly

Torsten Marek 
   python-nose (U)

A Mennucc1 
   python-freevo (U)

Loic Minier 
   moovida-plugins-ugly (U)
   pitivi

Steffen Moeller 
   mgltools-molkit (U)

Emilio Pozuelo Monfort 
   emesene

Sam Morris 
   pymsnt

Toni Mueller 
   roundup

Xavier Oswald 
   magicor

Anand Pillai 
   harvestman (U)

Python Applications Packaging Team 
   emesene (U)
   harvestman
   pyaimt (U)
   pyicqt (U)
   scribes (U)

Arnaud Quette 
   moovida-plugins-ugly (U)

Petter Reinholdtsen 
   python-sss

Reportbug Maintainers 
   python-reportbug

Patrick Ringl 
   pyicqt (U)

Stefan Ritter 
   uzbl

Miriam Ruiz 
   treeline

Filippo Rusconi 
   mmass (U)

Chris Silva 
   scribes

Gustavo Noronha Silva 
   python-nose

Jonas Smedegaard 
   python-swap

Jose Carlos Garcia Sogo 
   conduit

Christine Spang 
   quodlibet-plugins

Reinhard Tartler 
   idjc (U)

The Debichem Group 
   mmass

Paul van Tilburg 
   moovida-plugins-ugly (U)

Sandro Tosi 
   python-reportbug (U)

Alessio Treglia 
   idjc (U)

Guido Trotter 
   xen-utils-4.0 (U)

Daiki Ueno 
   ibus-skk

Julien Valroff 
   ajaxterm

Frederic Wagner 
   magicor (U)

Erik Wenzel 
   dynagen
   gns3

Jonathan Wiltshire 
   rednotebook

Michal Čihař 
   pyaimt
   pyicqt

ajaxterm_0.10-6 IOError /usr/share/ajaxterm/qweb.py:855
ajaxterm_0.10-6 IOError /usr/share/ajaxterm/qweb.py:872
anki_0.9.9.8.6-2.1 OSError /usr/share/anki/anki/sync.py:1166
anyremote2html_1.3-1 NameError /usr/bin/anyremote2html:371
conduit_0.3.17-1 TypeError /usr/share/pyshared/conduit/SyncSet.py:213
deluge-common_1.2.3+git20100712.0b609bf-1 ValueError 
/usr/share/pyshared/deluge/core/torrentmanager.py:542
deluge-gtk_1.2.3+git20100712.0b609bf-1 TypeError 
/usr/share/pyshared/deluge/ui/gtkui/torrentview.py:448
dynagen_0.11.0-5 AttributeError /usr/share/pyshared/confConsole.py:922
emesene_1.6.3-1 TypeError 
/usr/share/emesene/plugins_base/NotifyOsdImproved.py:453
fso-frameworkd_0.8.5.1-1 IOError 
/usr/share/pyshared/framework/subsystems/ogsmd/helpers.py:151
ganyremote_5.11.5-1 NameError /usr/bin/ganyremote:542
ganyremote_5.11.5-1 NameError /usr/bin/ganyremote:923
ganyremote_5.11.5-1 NameError /usr/bin/ganyremote:1091
ganyremote_5.11.5-1 NameError /usr/bin/ganyremote:1706
ganyremote_5.11.5-1 AttributeError /usr/bin/ganyremote:2350
ganyremote_5.11.5-1 AttributeError /usr/bin/ganyremote:2394
ganyremote_5.11.5-1 NameError /usr/bin/ganyremote:3649
ganyremote_5.11.5-1 NameError /usr/bin/ganyremote:3656
ganyremote_5.11.5-1 NameError /usr/bin/ganyremote:3735
ganyremote_5.11.5-1 AttributeError /usr/bin/ganyremote:3744
ganyremote_5.11.5-1 NameError /usr/bin/ganyremote:4276
ganyremote_5.11.5-1 NameError /usr/bin/ganyremote:4389
ganyremote_5.11.5-1 NameError /usr/bin/ganyremote:4396
ganyremote_5.11.5-1 NameError /usr/