Skip to content

Commit 6a0d828

Browse files
committed
Merge branch 'release/2.6.0'
2 parents f28b56a + faf78f1 commit 6a0d828

File tree

5 files changed

+33
-46
lines changed

5 files changed

+33
-46
lines changed

LICENSE

Lines changed: 6 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,11 @@
1-
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
2-
--------------------------------------------
1+
Copyright 2022 Rick van Hattem
32

4-
1. This LICENSE AGREEMENT is between the Python Software Foundation
5-
("PSF"), and the Individual or Organization ("Licensee") accessing and
6-
otherwise using this software ("Python") in source or binary form and
7-
its associated documentation.
3+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
84

9-
2. Subject to the terms and conditions of this License Agreement, PSF hereby
10-
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
11-
analyze, test, perform and/or display publicly, prepare derivative works,
12-
distribute, and otherwise use Python alone or in any derivative version,
13-
provided, however, that PSF's License Agreement and PSF's notice of copyright,
14-
i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
15-
Python Software Foundation; All Rights Reserved" are retained in Python alone or
16-
in any derivative version prepared by Licensee.
5+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
176

18-
3. In the event Licensee prepares a derivative work that is based on
19-
or incorporates Python or any part thereof, and wants to make
20-
the derivative work available to others as provided herein, then
21-
Licensee hereby agrees to include in any such work a brief summary of
22-
the changes made to Python.
7+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
238

24-
4. PSF is making Python available to Licensee on an "AS IS"
25-
basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
26-
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
27-
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
28-
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
29-
INFRINGE ANY THIRD PARTY RIGHTS.
30-
31-
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
32-
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
33-
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
34-
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
35-
36-
6. This License Agreement will automatically terminate upon a material
37-
breach of its terms and conditions.
38-
39-
7. Nothing in this License Agreement shall be deemed to create any
40-
relationship of agency, partnership, or joint venture between PSF and
41-
Licensee. This License Agreement does not grant permission to use PSF
42-
trademarks or trade name in a trademark sense to endorse or promote
43-
products or services of Licensee, or any third party.
44-
45-
8. By copying, installing or otherwise using Python, Licensee
46-
agrees to be bound by the terms and conditions of this License
47-
Agreement.
9+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
4810

11+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

portalocker/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
__package_name__ = 'portalocker'
22
__author__ = 'Rick van Hattem'
33
__email__ = '[email protected]'
4-
__version__ = '2.5.1'
4+
__version__ = '2.6.0'
55
__description__ = '''Wraps the portalocker recipe for easy usage'''
66
__url__ = 'https://github.com/WoLpH/portalocker'
77

portalocker/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#: Current author's email address
1818
__email__ = __about__.__email__
1919
#: Version number
20-
__version__ = '2.5.1'
20+
__version__ = '2.6.0'
2121
#: Package description for Pypi
2222
__description__ = __about__.__description__
2323
#: Package homepage

portalocker/portalocker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def lock(file_: typing.IO, flags: LockFlags):
106106
'or EXCLUSIVE flag must be specified as well')
107107

108108
try:
109-
fcntl.flock(file_.fileno(), flags)
109+
fcntl.flock(file_, flags)
110110
except locking_exceptions as exc_value:
111111
# The exception code varies on different systems so we'll catch
112112
# every IO error

portalocker_tests/tests.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,3 +331,27 @@ def test_exclusive_processes(tmpfile, fail_when_locked):
331331
a.exception_class or b.exception_class,
332332
portalocker.LockException
333333
)
334+
335+
336+
@pytest.mark.skipif(
337+
os.name == 'nt',
338+
reason='Locking on Windows requires a file object',
339+
)
340+
def test_lock_fileno(tmpfile):
341+
# Open the file 2 times
342+
a = open(tmpfile, 'a')
343+
b = open(tmpfile, 'a')
344+
345+
# Lock exclusive non-blocking
346+
flags = LockFlags.SHARED | LockFlags.NON_BLOCKING
347+
348+
# First lock file a
349+
portalocker.lock(a, flags)
350+
351+
# Now see if we can lock using fileno()
352+
portalocker.lock(b.fileno(), flags)
353+
354+
# Cleanup
355+
a.close()
356+
b.close()
357+

0 commit comments

Comments
 (0)