Re: [Python-Dev] r88580 - in python/branches/py3k: Doc/library/os.rst Doc/whatsnew/3.3.rst Lib/test/test_os.py Misc/NEWS Modules/posixmodule.c configure.in pyconfig.h.in

2011-02-25 Thread Antoine Pitrou
On Fri, 25 Feb 2011 15:39:16 +0100 (CET)
giampaolo.rodola python-check...@python.org wrote:

 +#else
 +*((off_t*)addr) = PyLong_Check(arg) ? PyLong_AsLongLong(arg)
 +: PyLong_AsLong(arg);
 +#endif

There's something fishy here. Why would you call PyLong_AsLong() if
PyLong_Check() is false?

Regards

Antoine.


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] r88580 - in python/branches/py3k: Doc/library/os.rst Doc/whatsnew/3.3.rst Lib/test/test_os.py Misc/NEWS Modules/posixmodule.c configure.in pyconfig.h.in

2011-02-25 Thread Ross Lagerwall
On Fri, 2011-02-25 at 18:32 +0100, Antoine Pitrou wrote:
 On Fri, 25 Feb 2011 15:39:16 +0100 (CET)
 giampaolo.rodola python-check...@python.org wrote:
 
  +#else
  +*((off_t*)addr) = PyLong_Check(arg) ? PyLong_AsLongLong(arg)
  +: PyLong_AsLong(arg);
  +#endif
 
 There's something fishy here. Why would you call PyLong_AsLong() if
 PyLong_Check() is false?
 

I'm not entirely sure how that works (other than it seems to!).
The code came from other places where large file support is, such as in
ftruncate() and lseek() in the posix module.

Ross

 
 ___
 Python-Dev mailing list
 Python-Dev@python.org
 http://mail.python.org/mailman/listinfo/python-dev
 Unsubscribe: 
 http://mail.python.org/mailman/options/python-dev/rosslagerwall%40gmail.com


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] r88580 - in python/branches/py3k: Doc/library/os.rst Doc/whatsnew/3.3.rst Lib/test/test_os.py Misc/NEWS Modules/posixmodule.c configure.in pyconfig.h.in

2011-02-25 Thread Antoine Pitrou
Le vendredi 25 février 2011 à 20:11 +0200, Ross Lagerwall a écrit :
 On Fri, 2011-02-25 at 18:32 +0100, Antoine Pitrou wrote:
  On Fri, 25 Feb 2011 15:39:16 +0100 (CET)
  giampaolo.rodola python-check...@python.org wrote:
  
   +#else
   +*((off_t*)addr) = PyLong_Check(arg) ? PyLong_AsLongLong(arg)
   +: PyLong_AsLong(arg);
   +#endif
  
  There's something fishy here. Why would you call PyLong_AsLong() if
  PyLong_Check() is false?
  
 
 I'm not entirely sure how that works (other than it seems to!).
 The code came from other places where large file support is, such as in
 ftruncate() and lseek() in the posix module.

Ok, then I guess that code was ported straightly from 2.x without really
a thought.
Thanks for your contribution, by the way!

Regards

Antoine.


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com