Bug#959724: codespell: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode

2020-05-25 Thread Vincent Lefevre
Version: 1.17.1-1

I could check that this bug is now fixed.

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



Bug#959724: codespell: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode

2020-05-22 Thread Vincent Lefevre
Control: tags -1 patch

On 2020-05-04 15:43:48 +0200, Vincent Lefevre wrote:
> Since the switch to python3.8, running codespell triggers a warning:
> 
> /usr/lib/python3.8/codecs.py:905: RuntimeWarning: line buffering 
> (buffering=1) isn't supported in binary mode, the default buffer size will be 
> used
>   file = builtins.open(filename, mode, buffering)
> 
> The bug against codespell was reported upstream here:
> 
>   https://github.com/codespell-project/codespell/issues/1331
> 
> now closed, as being fixed:
> 
>   https://github.com/codespell-project/codespell/pull/1401

I've attached a patch corresponding to

  
https://github.com/codespell-project/codespell/commit/33647e28b708c5736bab4608b1d422f0433eb0a8#diff-c4984ff60bb6d58a3a2f9940d1a396f9

for codespell 1.16.0-2.

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
Index: codespell-1.16.0/codespell_lib/_codespell.py
===
--- codespell-1.16.0.orig/codespell_lib/_codespell.py
+++ codespell-1.16.0/codespell_lib/_codespell.py
@@ -309,13 +309,13 @@ def build_exclude_hashes(filename, exclu
 
 
 def build_ignore_words(filename, ignore_words):
-with codecs.open(filename, mode='r', buffering=1, encoding='utf-8') as f:
+with codecs.open(filename, mode='r', encoding='utf-8') as f:
 for line in f:
 ignore_words.add(line.strip())
 
 
 def build_dict(filename, misspellings, ignore_words):
-with codecs.open(filename, mode='r', buffering=1, encoding='utf-8') as f:
+with codecs.open(filename, mode='r', encoding='utf-8') as f:
 for line in f:
 [key, data] = line.split('->')
 # TODO for now, convert both to lower. Someday we can maybe add
@@ -345,11 +345,8 @@ def build_dict(filename, misspellings, i
 def is_hidden(filename, check_hidden):
 bfilename = os.path.basename(filename)
 
-if bfilename != '' and bfilename != '.' and bfilename != '..' \
-and (not check_hidden and bfilename[0] == '.'):
-return True
-
-return False
+return bfilename not in ('', '.', '..') and \
+(not check_hidden and bfilename[0] == '.')
 
 
 def is_text_file(filename):


Bug#959724: codespell: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode

2020-05-04 Thread Vincent Lefevre
Package: codespell
Version: 1.16.0-2
Severity: important
Tags: upstream fixed-upstream

Since the switch to python3.8, running codespell triggers a warning:

/usr/lib/python3.8/codecs.py:905: RuntimeWarning: line buffering (buffering=1) 
isn't supported in binary mode, the default buffer size will be used
  file = builtins.open(filename, mode, buffering)

The bug against codespell was reported upstream here:

  https://github.com/codespell-project/codespell/issues/1331

now closed, as being fixed:

  https://github.com/codespell-project/codespell/pull/1401

Note that in addition to being annoying to the user, this can
break scripts, and was actually breaking one for GNU MPFR until
I implemented a workaround to filter this warning.

-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'stable-updates'), (500, 
'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.4.0-4-amd64 (SMP w/12 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=POSIX 
(charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages codespell depends on:
ii  python3  3.8.2-3
ii  python3-chardet  3.0.4-4

codespell recommends no packages.

codespell suggests no packages.

-- no debconf information

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)