Re: [Differential] D107: util: remove dead code which used to be for old python2 versions

2017-07-17 Thread alex_gaynor (Alex Gaynor)
alex_gaynor added a comment.


  @indygreg good flag, @durin42 and I had been discussing the "always use 
`memoryview`" as a potential follow up patch.
  
  For now this just deletes some dead code.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D107

EMAIL PREFERENCES
  https://phab.mercurial-scm.org/settings/panel/emailpreferences/

To: alex_gaynor, #hg-reviewers, durin42
Cc: indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [Differential] D107: util: remove dead code which used to be for old python2 versions

2017-07-17 Thread indygreg (Gregory Szorc)
indygreg added a comment.


  It's worth noting that in theory it should be possible to transition from 
buffer to memoryview. However, there are various bugs in various Python 2 
versions where memoryview isn't accepted. Most notable is that the zlib module 
doesn't accept memoryview until Python 3 IIRC. So we're stuck with buffer for a 
while :/

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D107

EMAIL PREFERENCES
  https://phab.mercurial-scm.org/settings/panel/emailpreferences/

To: alex_gaynor, #hg-reviewers, durin42
Cc: indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [Differential] D107: util: remove dead code which used to be for old python2 versions

2017-07-17 Thread alex_gaynor (Alex Gaynor)
alex_gaynor created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D107

AFFECTED FILES
  mercurial/util.py

CHANGE DETAILS

Index: mercurial/util.py
===
--- mercurial/util.py
+++ mercurial/util.py
@@ -295,16 +295,10 @@
 try:
 buffer = buffer
 except NameError:
-if not pycompat.ispy3:
-def buffer(sliceable, offset=0, length=None):
-if length is not None:
-return sliceable[offset:offset + length]
-return sliceable[offset:]
-else:
-def buffer(sliceable, offset=0, length=None):
-if length is not None:
-return memoryview(sliceable)[offset:offset + length]
-return memoryview(sliceable)[offset:]
+def buffer(sliceable, offset=0, length=None):
+if length is not None:
+return memoryview(sliceable)[offset:offset + length]
+return memoryview(sliceable)[offset:]
 
 closefds = pycompat.osname == 'posix'
 


EMAIL PREFERENCES
  https://phab.mercurial-scm.org/settings/panel/emailpreferences/

To: alex_gaynor, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel