[Python-checkins] r65586 - in python/trunk: Lib/subprocess.py Misc/NEWS

Brett Cannon brett at python.org
Fri Aug 8 20:53:59 CEST 2008


On Fri, Aug 8, 2008 at 2:46 AM, M.-A. Lemburg <mal at egenix.com> wrote:
> On 2008-08-08 06:19, brett.cannon wrote:
>>
>> Author: brett.cannon
>> Date: Fri Aug  8 06:19:32 2008
>> New Revision: 65586
>>
>> Log:
>> Remove warnings generated for the suprocess module when run under -3.
>> Required
>> commenting out True/False compatbility stuff, remove a use of apply(), and
>> remove a use of buffer() (just pulled the solution used in 3.0 which is
>> direct
>> slicing).
>
> You are aware of the fact that buffer() doesn't actually copy
> the data into a new object, but only references it ? A slice OTOH
> will do a copy.
>
> In this case, it's only 512 bytes, so probably nothing to worry about.
> However, it's not a good solution if you're talking about several 100kB
> that get copied instead of referenced.
>

Yes, I am completely aware of the fact. But with buffer() missing in
3.0 and memoryview() not supporting slicing yet, it was just easier to
rip out the use and just let the copying occur.

-Brett

>> Modified:
>>   python/trunk/Lib/subprocess.py
>>   python/trunk/Misc/NEWS
>>
>> Modified: python/trunk/Lib/subprocess.py
>>
>> ==============================================================================
>> --- python/trunk/Lib/subprocess.py      (original)
>> +++ python/trunk/Lib/subprocess.py      Fri Aug  8 06:19:32 2008
>> @@ -411,11 +411,11 @@
>>     MAXFD = 256
>>   # True/False does not exist on 2.2.0
>> -try:
>> -    False
>> -except NameError:
>> -    False = 0
>> -    True = 1
>> +#try:
>> +#    False
>> +#except NameError:
>> +#    False = 0
>> +#    True = 1
>>   _active = []
>>  @@ -1066,7 +1066,7 @@
>>                         os.chdir(cwd)
>>                       if preexec_fn:
>> -                        apply(preexec_fn)
>> +                        preexec_fn()
>>                       if env is None:
>>                         os.execvp(executable, args)
>> @@ -1173,7 +1173,8 @@
>>                     # When select has indicated that the file is writable,
>>                     # we can write up to PIPE_BUF bytes without risk
>>                     # blocking.  POSIX defines PIPE_BUF >= 512
>> -                    bytes_written = os.write(self.stdin.fileno(),
>> buffer(input, input_offset, 512))
>> +                    chunk = input[input_offset : input_offset + 512]
>> +                    bytes_written = os.write(self.stdin.fileno(), chunk)
>>                     input_offset += bytes_written
>>                     if input_offset >= len(input):
>>                         self.stdin.close()
>>
>> Modified: python/trunk/Misc/NEWS
>>
>> ==============================================================================
>> --- python/trunk/Misc/NEWS      (original)
>> +++ python/trunk/Misc/NEWS      Fri Aug  8 06:19:32 2008
>> @@ -48,8 +48,9 @@
>>   while running under the ``-3`` flag: aifc, asyncore, bdb, bsddb,
>>   ConfigParser, cookielib, DocXMLRPCServer, email, filecmp, fileinput,
>> inspect,
>>   logging, modulefinder, pdb, pickle, profile, pstats, pydoc, re,
>> rlcompleter,
>> -  SimpleXMLRPCServer, shelve, sqlite3, tarfile, Tkinter,
>> test.test_support,
>> -  textwrap, threading, tokenize, traceback, urlparse, wsgiref, xml,
>> xmlrpclib.
>> +  SimpleXMLRPCServer, shelve, subprocess, sqlite3, tarfile, Tkinter,
>> +  test.test_support, textwrap, threading, tokenize, traceback, urlparse,
>> +  wsgiref, xml, xmlrpclib.
>>   - Issue #3039: Fix tarfile.TarFileCompat.writestr() which always
>>   raised an AttributeError.
>> _______________________________________________
>> Python-checkins mailing list
>> Python-checkins at python.org
>> http://mail.python.org/mailman/listinfo/python-checkins
>
> --
> Marc-Andre Lemburg
> eGenix.com
>
> Professional Python Services directly from the Source  (#1, Aug 08 2008)
>>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
> ________________________________________________________________________
>
> :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::
>
>
>   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
>    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
>           Registered at Amtsgericht Duesseldorf: HRB 46611
> _______________________________________________
> Python-checkins mailing list
> Python-checkins at python.org
> http://mail.python.org/mailman/listinfo/python-checkins
>


More information about the Python-checkins mailing list