Re: [Python-Dev] Convert int() to size_t in Python/C
On 29 April 2016 at 18:11, Marcos Dione wrote: > On Fri, Apr 29, 2016 at 12:18:46PM -0400, Random832 wrote: >> On Fri, Apr 29, 2016, at 10:45, Marcos Dione wrote: >> > One possible solution hat was suggested to me in the #python IRC >> > channel was to use that, then test if the resulting value is negative, >> > and adjust accordingly, but I wonder if there is a cleaner, more general >> > solution (for instance, what if the type was something else, like loff_t, >> > although for that one in particular there *is* a convertion >> > function/macro). >> >> In principle, you could just use PyLong_AsUnsignedLong (or LongLong), >> and raise OverflowError manually if the value happens to be out of >> size_t's range. (99% sure that on every linux platform unsigned long is >> the same size as size_t. >> >> But it's not like it'd be the first function in OS to call a system call >> that takes a size_t. Read just uses Py_ssize_t. Write uses the buffer >> protocol, which uses Py_ssize_t. How concerned are you really about the >> lost range here? What does the system call return (its return type is >> ssize_t) if it writes more than SSIZE_MAX bytes? (This shouldn't be hard >> to test, just try copying a >2GB file on a 32-bit system) I would probably just use Py_ssize_t, since that is what the return value is. Otherwise, a large positive count input could return a negative value, which would be inconsistent, and could be mistaken as an error. > It's a very good point, but I don't have any 32 bits systems around > with a kernel-4.5. I'll try to figure it out and/or ask in the kernel ML. Maybe you can compile a 32-bit program and run it on a 64-bit computer (gcc -m32). ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Convert int() to size_t in Python/C
On 29 April 2016 at 18:25, Random832 wrote: > On Fri, Apr 29, 2016, at 14:11, Marcos Dione wrote: >> These are not output parameters, even if they're pointers. they'r >> using the NULL pointer to signal that the current offsets should not be >> touched, to differentiate from a offset of 0. Something that in Python we >> would use None. > > That's not actually true according to the documentation. (And if it > were, they could simply use -1 rather than a null pointer) > . . . >* If off_in is not NULL, then off_in must point to a buffer that > specifies the starting offset where bytes from fd_in will be > read. > The file offset of fd_in is not changed, >>>but off_in is > adjusted > appropriately.<<< Linux’s sendfile() syscall takes a similar offset parameter that may be updated, but Python’s os.sendfile() wrapper does not return the updated offset. Do you think we need to return the updated offsets for copy_file_range()? ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Problemas con modulos
2016-04-29 13:52 GMT-03:00 Guido van Rossum : > Thank you Facundo, and thanks for following up here! (I wonder if it > wouldn't have been just as efficient if you had just BCC'ed the list to your > original response? Or perhaps with a brief English note at the top?) Probably yes, I didn't want to mess the list with non-english stuff :) Regards, -- .Facundo Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/ Twitter: @facundobatista ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Problemas con modulos
Guido van Rossum writes: > Thank you Facundo, and thanks for following up here! (I wonder if it > wouldn't have been just as efficient if you had just BCC'ed the list to > your original response? Or perhaps with a brief English note at the > top?) BCC'ing lists usually gets your post held, rejected, or just discarded, although I don't have access to the python-dev configuration. IIRC reject is the default in Mailman. ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Convert int() to size_t in Python/C
On Fri, Apr 29, 2016, at 14:11, Marcos Dione wrote: > These are not output parameters, even if they're pointers. they'r > using the NULL pointer to signal that the current offsets should not be > touched, to differentiate from a offset of 0. Something that in Python we > would use None. That's not actually true according to the documentation. (And if it were, they could simply use -1 rather than a null pointer) If you pass a null pointer in, the file's offset is used and *is* updated, same as if you used an ordinary read/write call. If you pass a value in, that value is used *and updated* (which makes it an output parameter) and the file's offset is left alone. Documentation below, I've >>>highlighted<<< the part that shows they are used as output parameters: The following semantics apply for off_in, and similar statements apply to off_out: * If off_in is NULL, then bytes are read from fd_in starting from the file offset, and the file offset is adjusted by the number of bytes copied. * If off_in is not NULL, then off_in must point to a buffer that specifies the starting offset where bytes from fd_in will be read. The file offset of fd_in is not changed, >>>but off_in is adjusted appropriately.<<< ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Convert int() to size_t in Python/C
On Fri, Apr 29, 2016 at 12:18:46PM -0400, Random832 wrote: > On Fri, Apr 29, 2016, at 10:45, Marcos Dione wrote: > > One possible solution hat was suggested to me in the #python IRC > > channel was to use that, then test if the resulting value is negative, > > and adjust accordingly, but I wonder if there is a cleaner, more general > > solution (for instance, what if the type was something else, like loff_t, > > although for that one in particular there *is* a convertion > > function/macro). > > In principle, you could just use PyLong_AsUnsignedLong (or LongLong), > and raise OverflowError manually if the value happens to be out of > size_t's range. (99% sure that on every linux platform unsigned long is > the same size as size_t. > > But it's not like it'd be the first function in OS to call a system call > that takes a size_t. Read just uses Py_ssize_t. Write uses the buffer > protocol, which uses Py_ssize_t. How concerned are you really about the > lost range here? What does the system call return (its return type is > ssize_t) if it writes more than SSIZE_MAX bytes? (This shouldn't be hard > to test, just try copying a >2GB file on a 32-bit system) It's a very good point, but I don't have any 32 bits systems around with a kernel-4.5. I'll try to figure it out and/or ask in the kernel ML. > I'm more curious about what your calling convention is going to be for > off_in and off_out. I can't think of any other interfaces that have > optional output parameters. Python functions generally deal with output > parameters in the underlying C function (there are a few examples in > math) by returning a tuple. These are not output parameters, even if they're pointers. they'r using the NULL pointer to signal that the current offsets should not be touched, to differentiate from a offset of 0. Something that in Python we would use None. ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Convert int() to size_t in Python/C
On 4/29/2016 10:45 AM, Marcos Dione wrote: First of all, I'm not subbscribed to the list (too much traffic for me), so please CC: me in any answers if possible. I am indulging you this once, but the proper solution is to read pydev via the gmane.comp.python.devel mirror at news.gmane.com. You can do so either with a newsreader, part of most mail clients, subscribed to the group, or with a browser pointed at the site. There are multiple problems with CC:. First, the paragraph above may be (properly) snipped from replies, so you will not get replies to replies. Second, 'Reply all' is a nuisance as it takes 'all' too literally. Since I receive via gmane, Thunderbird tries to reply to both gmane and mail.python.org, but the latter is invalid and generates a nuisance email as I am not subscribed. If I were subscribed, sending and posting this twice would also be wrong. Third, and related, CC lists tend to grow. If someone hits 'Reply all' to this message, I will be added to the list, and will received a nuisance duplicate email, unless the person takes the trouble to remove me. (They often do not.) -- Terry Jan Reedy ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Problemas con modulos
Thank you Facundo, and thanks for following up here! (I wonder if it wouldn't have been just as efficient if you had just BCC'ed the list to your original response? Or perhaps with a brief English note at the top?) 2016-04-29 9:37 GMT-07:00 Facundo Batista : > Just to mention that I already answered this (in Spanish, in private), > redirecting to proper lists. > > Regards, > > 2016-04-29 5:04 GMT-03:00 Felipe Ruiz via Python-Dev < > python-dev@python.org>: > > Hola, > > > > Estoy intentando conectarme a twitter para recibir tweets, sin embargo > > algunos códigos que he bajado de internet, me indican que debo de > instalar > > tweepy y matplotlib, lo hago y sigo recibiendo el mensaje de que no están > > instalados. tweepy no reporta problemas, lo invoco en la línea de > comandos, > > todo bien, Igual con matplotlib requiere de varias dependencias > (dateutils, > > numpy, tornado, etc, ya las instales) antes de su instalación, pero ya > en el > > editor de Python, al ejecutar el código, me aparece el siguiente mensaje: > > > > ImportError: No module named 'matplotlib' > > > > alguna idea? > > > > Felipe > > > > ___ > > Python-Dev mailing list > > Python-Dev@python.org > > https://mail.python.org/mailman/listinfo/python-dev > > Unsubscribe: > > > https://mail.python.org/mailman/options/python-dev/facundobatista%40gmail.com > > > > > > -- > .Facundo > > Blog: http://www.taniquetil.com.ar/plog/ > PyAr: http://www.python.org/ar/ > Twitter: @facundobatista > ___ > Python-Dev mailing list > Python-Dev@python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/guido%40python.org > -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Problemas con modulos
Just to mention that I already answered this (in Spanish, in private), redirecting to proper lists. Regards, 2016-04-29 5:04 GMT-03:00 Felipe Ruiz via Python-Dev : > Hola, > > Estoy intentando conectarme a twitter para recibir tweets, sin embargo > algunos códigos que he bajado de internet, me indican que debo de instalar > tweepy y matplotlib, lo hago y sigo recibiendo el mensaje de que no están > instalados. tweepy no reporta problemas, lo invoco en la línea de comandos, > todo bien, Igual con matplotlib requiere de varias dependencias (dateutils, > numpy, tornado, etc, ya las instales) antes de su instalación, pero ya en el > editor de Python, al ejecutar el código, me aparece el siguiente mensaje: > > ImportError: No module named 'matplotlib' > > alguna idea? > > Felipe > > ___ > Python-Dev mailing list > Python-Dev@python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/facundobatista%40gmail.com > -- .Facundo Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/ Twitter: @facundobatista ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Summary of Python tracker Issues
ACTIVITY SUMMARY (2016-04-22 - 2016-04-29) Python tracker at http://bugs.python.org/ To view or respond to any of the issues listed below, click on the issue. Do NOT respond to this message. Issues counts and deltas: open5475 (-16) closed 33167 (+72) total 38642 (+56) Open issues with patches: 2380 Issues opened (40) == #26348: activate.fish sets VENV prompt incorrectly http://bugs.python.org/issue26348 reopened by brett.cannon #26830: Refactor Tools/scripts/google.py http://bugs.python.org/issue26830 opened by franciscouzo #26832: ProactorEventLoop doesn't support stdin/stdout nor files with http://bugs.python.org/issue26832 opened by Gabriel Mesquita Cangussu #26833: returning ctypes._SimpleCData objects from callbacks http://bugs.python.org/issue26833 opened by tilsche #26834: Add truncated SHA512/224 and SHA512/256 http://bugs.python.org/issue26834 opened by christian.heimes #26835: Add file-sealing ops to fcntl http://bugs.python.org/issue26835 opened by christian.heimes #26836: Add memfd_create to os module http://bugs.python.org/issue26836 opened by christian.heimes #26839: Python 3.5 running in a virtual machine with Linux kernel 3.17 http://bugs.python.org/issue26839 opened by doko #26844: Wrong error message during import http://bugs.python.org/issue26844 opened by lev.maximov #26845: Misleading variable name in exception handling http://bugs.python.org/issue26845 opened by Valentin.Lorentz #26848: asyncio.subprocess's communicate() method mishandles empty inp http://bugs.python.org/issue26848 opened by oconnor663 #26849: android does not support versioning in SONAME http://bugs.python.org/issue26849 opened by xdegaye #26850: PyMem_RawMalloc(): update also sys.getallocatedblocks() in deb http://bugs.python.org/issue26850 opened by haypo #26851: android compilation and link flags http://bugs.python.org/issue26851 opened by xdegaye #26852: add a COMPILEALL_FLAGS Makefile variable http://bugs.python.org/issue26852 opened by xdegaye #26855: add platform.android_ver() for android http://bugs.python.org/issue26855 opened by xdegaye #26856: android does not have pwd.getpwall() http://bugs.python.org/issue26856 opened by xdegaye #26858: setting SO_REUSEPORT fails on android http://bugs.python.org/issue26858 opened by xdegaye #26859: unittest fails with "Start directory is not importable" http://bugs.python.org/issue26859 opened by xdegaye #26860: os.walk and os.fwalk yield namedtuple instead of tuple http://bugs.python.org/issue26860 opened by palaviv #26861: shutil.copyfile() doesn't close the opened files http://bugs.python.org/issue26861 opened by vocdetnojz #26862: SYS_getdents64 does not need to be defined on android API 21 http://bugs.python.org/issue26862 opened by xdegaye #26864: urllib.request no_proxy check differs from curl http://bugs.python.org/issue26864 opened by Daniel Morrison #26865: Meta-issue: support of the android platform http://bugs.python.org/issue26865 opened by xdegaye #26866: Inconsistent environment in Windows using "Open With" http://bugs.python.org/issue26866 opened by busfault #26867: test_ssl test_options fails on ubuntu 16.04 http://bugs.python.org/issue26867 opened by xiang.zhang #26868: Document PyModule_AddObject's behavior on error http://bugs.python.org/issue26868 opened by berker.peksag #26869: unittest longMessage docs http://bugs.python.org/issue26869 opened by guettli #26870: Unexpected call to readline's add_history in call_readline http://bugs.python.org/issue26870 opened by tylercrompton #26871: Change weird behavior of PyModule_AddObject() http://bugs.python.org/issue26871 opened by serhiy.storchaka #26872: Default ConfigParser in python is not able to load values habi http://bugs.python.org/issue26872 opened by sorin #26873: xmlrpclib raises when trying to convert an int to string when http://bugs.python.org/issue26873 opened by Nathan Williams #26876: Extend MSVCCompiler class to respect environment variables http://bugs.python.org/issue26876 opened by rohitjamuar #26877: tarfile use wrong code when read from fileobj http://bugs.python.org/issue26877 opened by mmarkk #26878: Allow doctest to deep copy globals http://bugs.python.org/issue26878 opened by DqASe #26881: modulefinder should reuse the dis module http://bugs.python.org/issue26881 opened by haypo #26882: The Python process stops responding immediately after starting http://bugs.python.org/issue26882 opened by ÐлекÑÐ°Ð½Ð´Ñ ÐиногÑадов #26883: input() call blocks multiprocessing http://bugs.python.org/issue26883 opened by the #26884: cross-compilation of extension module links to the wrong pytho http://bugs.python.org/issue26884 opened by xdegaye #26885: Add parsing support for more types in xmlrpc http://bugs.python.org/issue26885 opened by serhiy.storchaka Most recent 15 issues with no replies (15) == #26885: Add parsing sup
Re: [Python-Dev] Convert int() to size_t in Python/C
On Fri, Apr 29, 2016, at 10:45, Marcos Dione wrote: > One possible solution hat was suggested to me in the #python IRC > channel was to use that, then test if the resulting value is negative, > and adjust accordingly, but I wonder if there is a cleaner, more general > solution (for instance, what if the type was something else, like loff_t, > although for that one in particular there *is* a convertion > function/macro). In principle, you could just use PyLong_AsUnsignedLong (or LongLong), and raise OverflowError manually if the value happens to be out of size_t's range. (99% sure that on every linux platform unsigned long is the same size as size_t. But it's not like it'd be the first function in OS to call a system call that takes a size_t. Read just uses Py_ssize_t. Write uses the buffer protocol, which uses Py_ssize_t. How concerned are you really about the lost range here? What does the system call return (its return type is ssize_t) if it writes more than SSIZE_MAX bytes? (This shouldn't be hard to test, just try copying a >2GB file on a 32-bit system) I'm more curious about what your calling convention is going to be for off_in and off_out. I can't think of any other interfaces that have optional output parameters. Python functions generally deal with output parameters in the underlying C function (there are a few examples in math) by returning a tuple. Maybe return a tuple (returned value, off_in, off_out), where None corresponds to the input parameter having been NULL (and passing None in makes it use NULL)? ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Problemas con modulos
Hola, Estoy intentando conectarme a twitter para recibir tweets, sin embargo algunos códigos que he bajado de internet, me indican que debo de instalar tweepy y matplotlib, lo hago y sigo recibiendo el mensaje de que no están instalados. tweepy no reporta problemas, lo invoco en la línea de comandos, todo bien, Igual con matplotlib requiere de varias dependencias (dateutils, numpy, tornado, etc, ya las instales) antes de su instalación, pero ya en el editor de Python, al ejecutar el código, me aparece el siguiente mensaje: ImportError: No module named 'matplotlib' alguna idea? Felipe___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Convert int() to size_t in Python/C
First of all, I'm not subbscribed to the list (too much traffic for me), so please CC: me in any answers if possible. I'm trying to add a new syscall to the os module: https://bugs.python.org/issue26826 One of the few missing parts is to cenvert a parameter, which would be a Python int object using PyArg_ParseTupleAndKeywords() to a size_t variable. For something similar, the 'n' format exists, but that one converts to Py_ssize_t (which is ssize_t, really), but that one is signed. One possible solution hat was suggested to me in the #python IRC channel was to use that, then test if the resulting value is negative, and adjust accordingly, but I wonder if there is a cleaner, more general solution (for instance, what if the type was something else, like loff_t, although for that one in particular there *is* a convertion function/macro). -- (Not so) Random fortune: Premature optimization is the root of all evil. -- Donald Knuth ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Needs to install python 3.4.4 in RHEL 6
On 29 April 2016 at 01:38, Zachary Ware wrote: > Hi Nilesh, > > On Thu, Apr 28, 2016 at 7:00 AM, Nilesh Date wrote: >> Hi team, >> >> I wanted to install python version 3.4.4 in my RHEL 6 system. >> Can someone give installation process or any reference link from which I can >> get required steps and download desire package. > > You have a couple of options. > > Option 1: use software collections [1]. As I vaguely understand it > (having never used this myself), the rh-python34 package is supported > by Red Hat, and is like any other package for the most part. Looking > at that page it does look a bit more complex than option 2 to me, but > I've built and installed Python several times over the past few years > :) Note that the versions hosted on softwarecollections.org are provided by the SCLo CentOS SIG. For the commercially supported versions, most RHEL subscriptions include access to the relevant channels: https://access.redhat.com/solutions/472793 Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com