Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
04d666cd
Commit
04d666cd
authored
Oct 12, 2018
by
Jason Madden
Committed by
GitHub
Oct 12, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1286 from gevent/issue1282
Fix #1282 by patching libuv
parents
d221b203
ba2223eb
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
73 additions
and
11 deletions
+73
-11
CHANGES.rst
CHANGES.rst
+6
-1
deps/README.rst
deps/README.rst
+3
-0
deps/libuv-win-binary.patch
deps/libuv-win-binary.patch
+20
-0
deps/libuv/src/win/fs.c
deps/libuv/src/win/fs.c
+8
-1
src/greentest/known_failures.py
src/greentest/known_failures.py
+0
-9
src/greentest/test__fileobject.py
src/greentest/test__fileobject.py
+36
-0
No files found.
CHANGES.rst
View file @
04d666cd
...
...
@@ -9,9 +9,14 @@
- Formatting run info no longer includes ``gevent.local.local``
objects that have no value in the greenlet. See :issue:`1275`.
- Fixed negative length in pywsgi's Input read functions for non chunked body.
Reported in :issue:`1274` by tzickel.
- Upgrabe libuv from 1.22.0 to 1.23.2.
- Upgrade libuv from 1.22.0 to 1.23.2.
- Fix opening files in text mode in CPython 2 on Windows by patching
libuv. See :issue:`1282` reported by wiggin15.
1.3.6 (2018-08-17)
==================
...
...
deps/README.rst
View file @
04d666cd
...
...
@@ -19,3 +19,6 @@ Updating libuv
- rm -rf libuv/test
- rm -rf libuv/tools
- rm -f libuv/android-configure*
- Apply the patches to libuv:
- git apply libuv-win-binary.patch
deps/libuv-win-binary.patch
0 → 100644
View file @
04d666cd
diff --git a/deps/libuv/src/win/fs.c b/deps/libuv/src/win/fs.c
index 812c1a6d..f4d66628 100644
--- a/deps/libuv/src/win/fs.c
+++ b/deps/libuv/src/win/fs.c
@@ -135,7 +135,14 @@
const WCHAR UNC_PATH_PREFIX_LEN = 8;
static int uv__file_symlink_usermode_flag = SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE;
void uv_fs_init(void) {
- _fmode = _O_BINARY;
+/* gevent: This breaks `open()` on CPython 2 by changing
+ * the default mode for file operations. Python 3 and PyPy
+ * ar unaffected. It was removed for the (unreleased) libuv 2.
+ * See https://github.com/gevent/gevent/issues/1282
+ */
+/*
+ * _fmode = _O_BINARY;
+ */
}
deps/libuv/src/win/fs.c
View file @
04d666cd
...
...
@@ -135,7 +135,14 @@ const WCHAR UNC_PATH_PREFIX_LEN = 8;
static
int
uv__file_symlink_usermode_flag
=
SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE
;
void
uv_fs_init
(
void
)
{
_fmode
=
_O_BINARY
;
/* gevent: This breaks `open()` on CPython 2 by changing
* the default mode for file operations. Python 3 and PyPy
* ar unaffected. It was removed for the (unreleased) libuv 2.
* See https://github.com/gevent/gevent/issues/1282
*/
/*
* _fmode = _O_BINARY;
*/
}
...
...
src/greentest/known_failures.py
View file @
04d666cd
...
...
@@ -62,15 +62,6 @@ if sys.platform == 'win32':
# This one sometimes randomly closes connections, but no indication
# of a server crash, only a client side close.
'FLAKY test__server_pywsgi.py'
,
# We only use FileObjectThread on Win32. Sometimes the
# visibility of the 'close' operation, which happens in a
# background thread, doesn't make it to the foreground
# thread in a timely fashion, leading to 'os.close(4) must
# not succeed' in test_del_close. We have the same thing
# with flushing and closing in test_newlines. Both of
# these are most commonly (only?) observed on Py27/64-bit.
# They also appear on 64-bit 3.6 with libuv
'FLAKY test__fileobject.py'
,
]
if
PYPY
and
LIBUV
:
...
...
src/greentest/test__fileobject.py
View file @
04d666cd
...
...
@@ -3,6 +3,7 @@ import os
import
sys
import
tempfile
import
gc
import
unittest
import
gevent
from
gevent.fileobject
import
FileObject
,
FileObjectThread
...
...
@@ -11,6 +12,7 @@ import greentest
from
greentest.sysinfo
import
PY3
from
greentest.flaky
import
reraiseFlakyTestRaceConditionLibuv
from
greentest.skipping
import
skipOnLibuvOnCIOnPyPy
from
greentest.skipping
import
skipOnWindows
try
:
ResourceWarning
...
...
@@ -61,10 +63,20 @@ class Test(greentest.TestCase):
with
FileObject
(
r
,
'rb'
)
as
fobj
:
self
.
assertEqual
(
fobj
.
read
(),
b'x'
)
# We only use FileObjectThread on Win32. Sometimes the
# visibility of the 'close' operation, which happens in a
# background thread, doesn't make it to the foreground
# thread in a timely fashion, leading to 'os.close(4) must
# not succeed' in test_del_close. We have the same thing
# with flushing and closing in test_newlines. Both of
# these are most commonly (only?) observed on Py27/64-bit.
# They also appear on 64-bit 3.6 with libuv
@
skipOnWindows
(
"Thread race conditions"
)
def
test_del
(
self
):
# Close should be true by default
self
.
_test_del
()
@
skipOnWindows
(
"Thread race conditions"
)
def
test_del_close
(
self
):
self
.
_test_del
(
close
=
True
)
...
...
@@ -172,5 +184,29 @@ def writer(fobj, line):
fobj
.
close
()
class
TestTextMode
(
unittest
.
TestCase
):
def
test_default_mode_writes_linesep
(
self
):
# See https://github.com/gevent/gevent/issues/1282
# libuv 1.x interferes with the default line mode on
# Windows.
# First, make sure we initialize gevent
gevent
.
get_hub
()
fileno
,
path
=
tempfile
.
mkstemp
(
'.gevent.test__fileobject.test_default'
)
self
.
addCleanup
(
os
.
remove
,
path
)
os
.
close
(
fileno
)
with
open
(
path
,
"w"
)
as
f
:
f
.
write
(
"
\
n
"
)
with
open
(
path
,
"rb"
)
as
f
:
data
=
f
.
read
()
self
.
assertEqual
(
data
,
os
.
linesep
.
encode
(
'ascii'
))
if
__name__
==
'__main__'
:
greentest
.
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment