harlowja / fasteners

A python package that provides useful locks.
Apache License 2.0
243 stars 45 forks source link

Bug in django framework. #79

Closed alexsilva closed 2 years ago

alexsilva commented 2 years ago

This library breaks the execution of the django framework (Both change the windll.kernel32.LockFileEx object)

https://github.com/django/django/blob/main/django/core/files/locks.py#L77

https://github.com/harlowja/fasteners/blob/master/fasteners/pywin32/win32file.py#L13

python manage.py collectstatic --noinput

Traceback (most recent call last):
  File "manage.py", line 83, in <module>
    main()
  File "manage.py", line 77, in main
    execute_from_command_line(argv)
  File "django\core\management\__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "django\core\management\__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "django\core\management\base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "django\core\management\base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "django\contrib\staticfiles\management\commands\collectstatic.py", line 188, in handle
    collected = self.collect()
  File "django\contrib\staticfiles\management\commands\collectstatic.py", line 114, in collect
    handler(path, prefixed_path, storage)
  File "django\contrib\staticfiles\management\commands\collectstatic.py", line 352, in copy_file
    self.storage.save(prefixed_path, source_file)
  File "django\core\files\storage.py", line 54, in save
    return self._save(name, content)
  File "django\core\files\storage.py", line 283, in _save
    locks.unlock(fd)
  File "django\core\files\locks.py", line 86, in unlock
    ret = UnlockFileEx(hfile, 0, 0, 0xFFFF0000, byref(overlapped))
ctypes.ArgumentError: argument 5: <class 'TypeError'>: expected LP_OVERLAPPED instance instead of pointer to OVERLAPPED
psarka commented 2 years ago

Fascinating! Thanks for the bug report, I'll see what can be done.