Author Michael.Felt
Recipients Michael.Felt, vstinner
Date 2019-01-05.16:26:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <3e5d1e6c-6684-2b19-7343-780c7ec45846@felt.demon.nl>
In-reply-to <1546641770.58.0.407709063686.issue35633@roundup.psfhosted.org>
Content
On 04/01/2019 23:42, STINNER Victor wrote:
> STINNER Victor <vstinner@redhat.com> added the comment:
>
> Does the test pass if you open the file in read+write ("w+b") mode rather than write-only ("wb") mode?
>
> I'm talking about this line:
>
> open(support.TESTFN, 'wb')
>
> Note: if you want to test, you have the modify the mode twice:
>   "with open('%s', 'wb') as f:" % support.TESTFN,
> and
>   with open(support.TESTFN, 'wb') as f:

Without except containing PermissionError:

  +500          with kill_on_error(proc):
  +501              with open(support.TESTFN, 'w+b') as f:
  +502                  while True:  # synchronize the subprocess
  +503                      dt = time.monotonic() - start_time
  +504                      if dt > 60.0:
  +505                          raise Exception("failed to sync child in
%.1f sec" % dt)
  +506                      try:
  +507                          lock_func(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
  +508                          lock_func(f, fcntl.LOCK_UN)
  +509                          time.sleep(0.01)
  +510                      except BlockingIOError:
  +511                          break
FAILS on test_lockf, passes on test_flock -> with open(support.TESTFN,
'w+b') as f:

FAILS on both test_lockf and test_flock (as expected I am guessing) ->
with open(support.TESTFN, 'r+b') as f:

I am not python savvy enough to get it tested using the syntax: ' "with
open('%s', 'wb') as f:" % support.TESTFN, '

  +500          with kill_on_error(proc):
  +501              "with open('%s', 'wb') as f:" % support.TESTFN,
  +502                  while True:  # synchronize the subprocess
  +503                      dt = time.monotonic() - start_time
  +504                      if dt > 60.0:
  +505                          raise Exception("failed to sync child in
%.1f sec" % dt)
  +506                      try:
  +507                          lock_func(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
  +508                          lock_func(f, fcntl.LOCK_UN)
  +509                          time.sleep(0.01)
  +510                      except BlockingIOError:
  +511                          break

--- run eintr_tester.py ---
  File
"/data/prj/python/git/python3-3.8/Lib/test/eintrdata/eintr_tester.py",
line 502
    while True:  # synchronize the subprocess
    ^
IndentationError: unexpected indent
--- eintr_tester.py completed: exit code 1 ---

>
> ----------
> nosy: +vstinner
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue35633>
> _______________________________________
>
History
Date User Action Args
2019-01-05 16:26:55Michael.Feltsetrecipients: + Michael.Felt, vstinner
2019-01-05 16:26:53Michael.Feltlinkissue35633 messages
2019-01-05 16:26:53Michael.Feltcreate