Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions Lib/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@
from _io import (DEFAULT_BUFFER_SIZE, BlockingIOError, UnsupportedOperation,
open, open_code, FileIO, BytesIO, StringIO, BufferedReader,
BufferedWriter, BufferedRWPair, BufferedRandom,
# XXX RUSTPYTHON TODO: IncrementalNewlineDecoder
# IncrementalNewlineDecoder,
text_encoding, TextIOWrapper)
IncrementalNewlineDecoder, text_encoding, TextIOWrapper)

# Pretend this exception was created here.
UnsupportedOperation.__module__ = "io"
Expand Down Expand Up @@ -100,10 +98,3 @@ class TextIOBase(_io._TextIOBase, IOBase):
pass
else:
RawIOBase.register(_WindowsConsoleIO)


# XXX: RUSTPYTHON; borrow IncrementalNewlineDecoder from _pyio
try:
from _pyio import IncrementalNewlineDecoder
except ImportError:
pass
1 change: 0 additions & 1 deletion Lib/test/test_difflib.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ def test_mdiff_catch_stop_iteration(self):
the end"""

class TestSFpatches(unittest.TestCase):
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_html_diff(self):
# Check SF patch 914575 for generating HTML differences
f1a = ((patch914575_from1 + '123\n'*10)*3)
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_fileinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,6 @@ def __call__(self, *args, **kargs):
fi.readline()
self.assertTrue(custom_open_hook.invoked, "openhook not invoked")

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_readline(self):
with open(TESTFN, 'wb') as f:
f.write(b'A\nB\r\nC\r')
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_imp.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def test_find_module_encoding(self):
with self.assertRaises(SyntaxError):
imp.find_module('badsyntax_pep3120', path)

@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_issue1267(self):
for mod, encoding, _ in self.test_strings:
fp, filename, info = imp.find_module('module_' + mod,
Expand Down
10 changes: 0 additions & 10 deletions Lib/test/test_importlib/test_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,8 +701,6 @@ def verify_code(self, code_object):
class SourceOnlyLoaderTests(SourceLoaderTestHarness):
"""Test importlib.abc.SourceLoader for source-only loading."""

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_get_source(self):
# Verify the source code is returned as a string.
# If an OSError is raised by get_data then raise ImportError.
Expand Down Expand Up @@ -761,8 +759,6 @@ def test_package_settings(self):
self.verify_module(module)
self.assertFalse(hasattr(module, '__path__'))

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_get_source_encoding(self):
# Source is considered encoded in UTF-8 by default unless otherwise
# specified by an encoding line.
Expand Down Expand Up @@ -882,8 +878,6 @@ class SourceLoaderGetSourceTests:

"""Tests for importlib.abc.SourceLoader.get_source()."""

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_default_encoding(self):
# Should have no problems with UTF-8 text.
name = 'mod'
Expand All @@ -893,8 +887,6 @@ def test_default_encoding(self):
returned_source = mock.get_source(name)
self.assertEqual(returned_source, source)

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_decoded_source(self):
# Decoding should work.
name = 'mod'
Expand All @@ -905,8 +897,6 @@ def test_decoded_source(self):
returned_source = mock.get_source(name)
self.assertEqual(returned_source, source)

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_universal_newlines(self):
# PEP 302 says universal newlines should be used.
name = 'mod'
Expand Down
6 changes: 0 additions & 6 deletions Lib/test/test_importlib/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,16 @@ class DecodeSourceBytesTests:

source = "string ='ü'"

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_ut8_default(self):
source_bytes = self.source.encode('utf-8')
self.assertEqual(self.util.decode_source(source_bytes), self.source)

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_specified_encoding(self):
source = '# coding=latin-1\n' + self.source
source_bytes = source.encode('latin-1')
assert source_bytes != source.encode('utf-8')
self.assertEqual(self.util.decode_source(source_bytes), source)

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_universal_newlines(self):
source = '\r\n'.join([self.source, self.source])
source_bytes = source.encode('utf-8')
Expand Down
40 changes: 0 additions & 40 deletions Lib/test/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -4121,41 +4121,6 @@ def test_newlines(self):
def test_newlines_input(self):
super().test_newlines_input()

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_read_one_by_one(self):
super().test_read_one_by_one()

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_read_by_chunk(self):
super().test_read_by_chunk()

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_issue1395_1(self):
super().test_issue1395_1()

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_issue1395_2(self):
super().test_issue1395_2()

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_issue1395_3(self):
super().test_issue1395_3()

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_issue1395_4(self):
super().test_issue1395_4()

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_issue1395_5(self):
super().test_issue1395_5()

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_reconfigure_write_through(self):
Expand Down Expand Up @@ -4812,11 +4777,6 @@ class CMiscIOTest(MiscIOTest):
name_of_module = "io", "_io"
extra_exported = "BlockingIOError",

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test___all__(self):
super().test___all__()

def test_readinto_buffer_overflow(self):
# Issue #18025
class BadReader(self.io.BufferedIOBase):
Expand Down
6 changes: 0 additions & 6 deletions Lib/test/test_linecache.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,6 @@ def test_lazycache_no_globals(self):
self.assertEqual(False, linecache.lazycache(FILENAME, None))
self.assertEqual(lines, linecache.getlines(FILENAME))

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_lazycache_smoke(self):
lines = linecache.getlines(NONEXISTENT_FILENAME, globals())
linecache.clearcache()
Expand All @@ -199,8 +197,6 @@ def test_lazycache_smoke(self):
# globals: this would error if the lazy value wasn't resolved.
self.assertEqual(lines, linecache.getlines(NONEXISTENT_FILENAME))

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_lazycache_provide_after_failed_lookup(self):
linecache.clearcache()
lines = linecache.getlines(NONEXISTENT_FILENAME, globals())
Expand All @@ -219,8 +215,6 @@ def test_lazycache_bad_filename(self):
self.assertEqual(False, linecache.lazycache('', globals()))
self.assertEqual(False, linecache.lazycache('<foo>', globals()))

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_lazycache_already_cached(self):
linecache.clearcache()
lines = linecache.getlines(NONEXISTENT_FILENAME, globals())
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_popen.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,10 @@ def test_return_code(self):
else:
self.assertEqual(os.waitstatus_to_exitcode(status), 42)

@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_contextmanager(self):
with os.popen("echo hello") as f:
self.assertEqual(f.read(), "hello\n")

@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_iterating(self):
with os.popen("echo hello") as f:
self.assertEqual(list(f), ["hello\n"])
Expand Down
5 changes: 0 additions & 5 deletions Lib/test/test_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -1056,8 +1056,6 @@ def test_writes_before_communicate(self):
self.assertEqual(stdout, b"bananasplit")
self.assertEqual(stderr, b"")

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_universal_newlines_and_text(self):
args = [
sys.executable, "-c",
Expand Down Expand Up @@ -1097,7 +1095,6 @@ def test_universal_newlines_and_text(self):
self.assertEqual(p.stdout.read(),
"line4\nline5\nline6\nline7\nline8")

@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_universal_newlines_communicate(self):
# universal newlines through communicate()
p = subprocess.Popen([sys.executable, "-c",
Expand Down Expand Up @@ -1149,7 +1146,6 @@ def test_universal_newlines_communicate_input_none(self):
p.communicate()
self.assertEqual(p.returncode, 0)

@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_universal_newlines_communicate_stdin_stdout_stderr(self):
# universal newlines through communicate(), with stdin, stdout, stderr
p = subprocess.Popen([sys.executable, "-c",
Expand Down Expand Up @@ -3805,7 +3801,6 @@ def popen_via_context_manager(*args, **kwargs):
raise KeyboardInterrupt # Test how __exit__ handles ^C.
self._test_keyboardinterrupt_no_kill(popen_via_context_manager)

@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_getoutput(self):
self.assertEqual(subprocess.getoutput('echo xyzzy'), 'xyzzy')
self.assertEqual(subprocess.getstatusoutput('echo xyzzy'),
Expand Down
18 changes: 0 additions & 18 deletions Lib/test/test_traceback.py
Original file line number Diff line number Diff line change
Expand Up @@ -1040,8 +1040,6 @@ def extract():

class TestFrame(unittest.TestCase):

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_basics(self):
linecache.clearcache()
linecache.lazycache("f", globals())
Expand All @@ -1059,8 +1057,6 @@ def test_basics(self):
self.assertNotEqual(f, object())
self.assertEqual(f, ALWAYS_EQ)

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_lazy_lines(self):
linecache.clearcache()
f = traceback.FrameSummary("f", 1, "dummy", lookup_line=False)
Expand Down Expand Up @@ -1109,8 +1105,6 @@ def test_extract_stack_limit(self):
s = traceback.StackSummary.extract(traceback.walk_stack(None), limit=5)
self.assertEqual(len(s), 5)

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_extract_stack_lookup_lines(self):
linecache.clearcache()
linecache.updatecache('/foo.py', globals())
Expand All @@ -1120,8 +1114,6 @@ def test_extract_stack_lookup_lines(self):
linecache.clearcache()
self.assertEqual(s[0].line, "import sys")

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_extract_stackup_deferred_lookup_lines(self):
linecache.clearcache()
c = test_code('/foo.py', 'method')
Expand Down Expand Up @@ -1153,17 +1145,13 @@ def test_format_smoke(self):
[' File "foo.py", line 1, in fred\n line\n'],
s.format())

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_locals(self):
linecache.updatecache('/foo.py', globals())
c = test_code('/foo.py', 'method')
f = test_frame(c, globals(), {'something': 1})
s = traceback.StackSummary.extract(iter([(f, 6)]), capture_locals=True)
self.assertEqual(s[0].locals, {'something': '1'})

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_no_locals(self):
linecache.updatecache('/foo.py', globals())
c = test_code('/foo.py', 'method')
Expand Down Expand Up @@ -1444,8 +1432,6 @@ def recurse(n):
traceback.walk_tb(exc_info[2]), limit=5)
self.assertEqual(expected_stack, exc.stack)

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_lookup_lines(self):
linecache.clearcache()
e = Exception("uh oh")
Expand All @@ -1457,8 +1443,6 @@ def test_lookup_lines(self):
linecache.updatecache('/foo.py', globals())
self.assertEqual(exc.stack[0].line, "import sys")

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_locals(self):
linecache.updatecache('/foo.py', globals())
e = Exception("uh oh")
Expand All @@ -1470,8 +1454,6 @@ def test_locals(self):
self.assertEqual(
exc.stack[0].locals, {'something': '1', 'other': "'string'"})

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_no_locals(self):
linecache.updatecache('/foo.py', globals())
e = Exception("uh oh")
Expand Down
5 changes: 5 additions & 0 deletions common/src/lock/thread_mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ impl<R: RawMutex, G: GetThreadId, T: Default> Default for ThreadMutex<R, G, T> {
Self::new(T::default())
}
}
impl<R: RawMutex, G: GetThreadId, T> From<T> for ThreadMutex<R, G, T> {
fn from(val: T) -> Self {
Self::new(val)
}
}
impl<R: RawMutex, G: GetThreadId, T: ?Sized> ThreadMutex<R, G, T> {
pub fn lock(&self) -> Option<ThreadMutexGuard<R, G, T>> {
if self.raw.lock() {
Expand Down
3 changes: 2 additions & 1 deletion derive-impl/src/from_args.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use proc_macro2::TokenStream;
use quote::{quote, ToTokens};
use syn::ext::IdentExt;
use syn::{
parse_quote, Attribute, Data, DeriveInput, Expr, Field, Ident, Lit, Meta, NestedMeta, Result,
};
Expand Down Expand Up @@ -138,7 +139,7 @@ fn generate_field((i, field): (usize, &Field)) -> Result<TokenStream> {
};

let name = field.ident.as_ref();
let name_string = name.map(Ident::to_string);
let name_string = name.map(|ident| ident.unraw().to_string());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

if matches!(&name_string, Some(s) if s.starts_with("_phantom")) {
return Ok(quote! {
#name: ::std::marker::PhantomData,
Expand Down
Loading
Loading