repo
stringclasses
15 values
pull_number
int64
147
18.3k
instance_id
stringlengths
14
31
issue_numbers
listlengths
1
3
base_commit
stringlengths
40
40
patch
stringlengths
289
585k
test_patch
stringlengths
355
6.82M
problem_statement
stringlengths
25
49.4k
hints_text
stringlengths
0
58.9k
created_at
timestamp[us, tz=UTC]date
2014-08-08 22:09:38
2024-06-28 03:13:12
version
stringclasses
110 values
PASS_TO_PASS
listlengths
0
4.82k
FAIL_TO_PASS
listlengths
1
1.06k
language
stringclasses
4 values
image_urls
listlengths
0
4
website links
listlengths
0
4
assertj/assertj
1,166
assertj__assertj-1166
[ "1133" ]
4402d598aeb45da32522201f1bc19b72747224a3
diff --git a/src/main/java/org/assertj/core/api/AbstractDateAssert.java b/src/main/java/org/assertj/core/api/AbstractDateAssert.java --- a/src/main/java/org/assertj/core/api/AbstractDateAssert.java +++ b/src/main/java/org/assertj/core/api/AbstractDateAssert.java @@ -16,10 +16,7 @@ import static java.util.concurrent.Ti...
diff --git a/src/test/java/org/assertj/core/api/date/AbstractDateAssertWithDateArg_Test.java b/src/test/java/org/assertj/core/api/date/AbstractDateAssertWithDateArg_Test.java --- a/src/test/java/org/assertj/core/api/date/AbstractDateAssertWithDateArg_Test.java +++ b/src/test/java/org/assertj/core/api/date/AbstractDateA...
Add "yyyy-MM-dd'T'HH:mm:ssX" timezone aware format to default ones. #### Summary Add "yyyy-MM-dd'T'HH:mm:ssX" to the default date formats to support TZ comparison. #### Example ```java Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); cal.clear(); cal.set(2017, Calendar.NOVEMBER, 27, 20, 13...
2018-01-25T23:38:04Z
3.10
[]
[ "org.org.assertj.core.api.date.DateAssert_with_string_based_date_representation_Test" ]
Java
[]
[]
assertj/assertj
1,184
assertj__assertj-1184
[ "1175" ]
48cbf8e2fbb7185492aba6e4fa2dfdc659139a45
diff --git a/src/main/java/org/assertj/core/api/AbstractFileAssert.java b/src/main/java/org/assertj/core/api/AbstractFileAssert.java --- a/src/main/java/org/assertj/core/api/AbstractFileAssert.java +++ b/src/main/java/org/assertj/core/api/AbstractFileAssert.java @@ -16,8 +16,8 @@ import static org.assertj.core.util.Pr...
diff --git a/src/test/java/org/assertj/core/api/WithAssertions_delegation_Test.java b/src/test/java/org/assertj/core/api/WithAssertions_delegation_Test.java --- a/src/test/java/org/assertj/core/api/WithAssertions_delegation_Test.java +++ b/src/test/java/org/assertj/core/api/WithAssertions_delegation_Test.java @@ -17,6 ...
Replace RuntimeIOException with UncheckedIOException? Should we replace the AssertJ specific `RuntimeIOException` with `UncheckedIOException` which was added in Java 8?
I can work on this 👍 @joel-costigliola what should we do with the missing constructors in UncheckedIOException? e.g. RuntimeIOException(String message) UncheckedIOException Constructors: UncheckedIOException(IOException cause) UncheckedIOException(String message, IOException cause) can't we use `UncheckedI...
2018-02-18T12:17:19Z
3.10
[]
[ "org.org.assertj.core.internal.files.Files_assertSameContentAs_Test", "org.org.assertj.core.internal.files.Files_assertHasBinaryContent_Test", "org.org.assertj.core.internal.files.Files_assertHasContent_Test", "org.org.assertj.core.internal.files.Files_assertHasParent_Test", "org.org.assertj.core.internal.p...
Java
[]
[]
assertj/assertj
1,204
assertj__assertj-1204
[ "1145" ]
99b8065754ee41dfe29e626b4f66fd1d1ba8aec3
diff --git a/src/main/java/org/assertj/core/error/ShouldBeEqualByComparingFieldByFieldRecursively.java b/src/main/java/org/assertj/core/error/ShouldBeEqualByComparingFieldByFieldRecursively.java --- a/src/main/java/org/assertj/core/error/ShouldBeEqualByComparingFieldByFieldRecursively.java +++ b/src/main/java/org/asser...
diff --git a/src/test/java/org/assertj/core/error/ShouldBeEqualByComparingFieldByFieldRecursively_create_Test.java b/src/test/java/org/assertj/core/error/ShouldBeEqualByComparingFieldByFieldRecursively_create_Test.java --- a/src/test/java/org/assertj/core/error/ShouldBeEqualByComparingFieldByFieldRecursively_create_Tes...
`isEqualToComparingFieldByFieldRecursively` throws NullPointerException while comparing null values #### Summary If a nested field is null while comparing equality for two objects with `isEqualToComparingFieldByFieldRecursively` a NullPointerException is thrown. ### Stacktrace ``` Exception in thread "main" j...
Thanks for reporting this ! This is regression in version `2.9.0/3.9.0` introduced by https://github.com/joel-costigliola/assertj-core/commit/fb9f9522f7abe2d863af6aa760ec7e8162009f49 @hwielenberg As a workaround you can use `3.8.0` I could write the Bugfix if you want. Should be straightforward. Contributions w...
2018-03-13T19:54:11Z
2.9
[]
[ "org.org.assertj.core.error.ShouldBeEqualByComparingFieldByFieldRecursively_create_Test" ]
Java
[]
[]
assertj/assertj
1,332
assertj__assertj-1332
[ "1331" ]
1747c1e5df371cef2750dc4321eaf391670e294c
diff --git a/src/main/java/org/assertj/core/internal/Strings.java b/src/main/java/org/assertj/core/internal/Strings.java --- a/src/main/java/org/assertj/core/internal/Strings.java +++ b/src/main/java/org/assertj/core/internal/Strings.java @@ -550,7 +550,7 @@ private void checkCharSequenceIsNotNull(CharSequence sequence...
diff --git a/src/test/java/org/assertj/core/internal/strings/Strings_assertEqualsIgnoringWhitespace_Test.java b/src/test/java/org/assertj/core/internal/strings/Strings_assertEqualsIgnoringWhitespace_Test.java --- a/src/test/java/org/assertj/core/internal/strings/Strings_assertEqualsIgnoringWhitespace_Test.java +++ b/sr...
Throw AssertionFailedError instead of AssertionError in non-strict string assertions #### Summary Throwing AssertionFailedError from opentest4j facilitates test failure analysis in IDE providing handy "diff" view. AssertJ already uses AssertionFailedError (if available on the classpath) but not in non-strict string a...
2018-09-26T23:58:31Z
3.11
[]
[ "org.org.assertj.core.internal.strings.Strings_assertEqualsIgnoringWhitespace_Test", "org.org.assertj.core.internal.strings.Strings_assertIsEqualToNormalizingNewlines_Test", "org.org.assertj.core.internal.strings.Strings_assertIsEqualsToIgnoringNewLines_Test" ]
Java
[]
[]
assertj/assertj
1,587
assertj__assertj-1587
[ "1586" ]
eb1a64c955e15dca75a62ad4418099026060cc06
diff --git a/src/main/java/org/assertj/core/internal/Strings.java b/src/main/java/org/assertj/core/internal/Strings.java --- a/src/main/java/org/assertj/core/internal/Strings.java +++ b/src/main/java/org/assertj/core/internal/Strings.java @@ -381,7 +381,7 @@ public void assertHasSizeGreaterThanOrEqualTo(AssertionInfo i...
diff --git a/src/test/java/org/assertj/core/internal/strings/Strings_assertHasSizeBetween_Test.java b/src/test/java/org/assertj/core/internal/strings/Strings_assertHasSizeBetween_Test.java new file mode 100644 --- /dev/null +++ b/src/test/java/org/assertj/core/internal/strings/Strings_assertHasSizeBetween_Test.java @@ ...
The assertion assertThat().HasSizeBetween() does not work with strings #### Summary The assertion assertThat().hasSizeBetween() with strings does not work, assertj-core seems to confuse string lengths between actual, min and max. #### Example ```java assertThat("Test1").hasSizeBetween(4, 11); ``` throws a c...
2019-08-27T20:37:33Z
3.13
[]
[ "org.org.assertj.core.internal.strings.Strings_assertHasSizeBetween_Test" ]
Java
[]
[]
assertj/assertj
1,629
assertj__assertj-1629
[ "1628" ]
9f7ab5b7f2ee2b015b5268a323b4ac69bca5240a
diff --git a/src/main/java/org/assertj/core/api/SoftProxies.java b/src/main/java/org/assertj/core/api/SoftProxies.java --- a/src/main/java/org/assertj/core/api/SoftProxies.java +++ b/src/main/java/org/assertj/core/api/SoftProxies.java @@ -54,6 +54,7 @@ class SoftProxies { ...
diff --git a/src/test/java/org/assertj/core/api/SoftAssertionsTest.java b/src/test/java/org/assertj/core/api/SoftAssertionsTest.java --- a/src/test/java/org/assertj/core/api/SoftAssertionsTest.java +++ b/src/test/java/org/assertj/core/api/SoftAssertionsTest.java @@ -823,24 +823,18 @@ public void should_work_with_predic...
AbstractOptionalAssert#get() is not correctly proxied with SoftAssertions #### Summary AbstractOptionalAssert#get() is not listed under `METHODS_CHANGING_THE_OBJECT_UNDER_TEST` of `SoftProxies`. #### Example ```java SoftAssertions softly = new SoftAssertions(); Optional<String> optional = Optional.of("Yoda"); ...
Good catch!
2019-10-06T08:57:07Z
3.14
[]
[ "org.org.assertj.core.api.SoftAssertionsTest" ]
Java
[]
[]
assertj/assertj
1,753
assertj__assertj-1753
[ "1751" ]
6b963c13b7a341a3acd419396d1918ef1d651b4e
diff --git a/src/main/java/org/assertj/core/api/AbstractMapAssert.java b/src/main/java/org/assertj/core/api/AbstractMapAssert.java --- a/src/main/java/org/assertj/core/api/AbstractMapAssert.java +++ b/src/main/java/org/assertj/core/api/AbstractMapAssert.java @@ -22,6 +22,7 @@ import static org.assertj.core.util.Arrays...
diff --git a/src/test/java/org/assertj/core/api/map/MapAssert_containsOnlyKeys_with_Path_Test.java b/src/test/java/org/assertj/core/api/map/MapAssert_containsOnlyKeys_with_Path_Test.java new file mode 100644 --- /dev/null +++ b/src/test/java/org/assertj/core/api/map/MapAssert_containsOnlyKeys_with_Path_Test.java @@ -0,...
Updating from 3.11.1 to 3.14.0 breaks When I try to upgrade assertj-core from 3.11.1 to the latest version 3.14.0. The following code breaks. ``` import static org.assertj.core.api.Assertions.assertThat; import java.nio.file.Path; import java.nio.file.Paths; import java.util.HashMap; import java.util.Map; im...
Thanks for reporting this, we will look at it shortly. The (subtle) issue is the addition of `containsOnlyKeys(Iterable<? extends K> keys)` in 3.12.0, it turns out to be a breaking change when given a `Path`, as `Path` is an `Iterable` the new method is called which check the elements (`tmp, test, file`) instead of the...
2020-01-12T14:46:38Z
3.14
[]
[ "org.org.assertj.core.api.map.MapAssert_containsOnlyKeys_with_Path_Test" ]
Java
[]
[]
assertj/assertj
1,763
assertj__assertj-1763
[ "1759" ]
deab4c1489ed623ec83083c083d020cd480552b7
diff --git a/src/main/java/org/assertj/core/util/introspection/PropertyOrFieldSupport.java b/src/main/java/org/assertj/core/util/introspection/PropertyOrFieldSupport.java --- a/src/main/java/org/assertj/core/util/introspection/PropertyOrFieldSupport.java +++ b/src/main/java/org/assertj/core/util/introspection/PropertyO...
diff --git a/src/test/java/org/assertj/core/util/introspection/PropertyOrFieldSupport_getSimpleValue_with_Map_input_Test.java b/src/test/java/org/assertj/core/util/introspection/PropertyOrFieldSupport_getSimpleValue_with_Map_input_Test.java new file mode 100644 --- /dev/null +++ b/src/test/java/org/assertj/core/util/in...
Assertion hasNoNullFieldsOrProperties() throw error for delegate Map implementation #### Summary We have some own classes with extra logic that implement Map interface but delegate invocation to backed HashMap. This is related commit https://github.com/joel-costigliola/assertj-core/commit/337f99eee5cdcab9270145c47b4...
Thanks for reporting this, we are going to look at it shortly!
2020-01-25T23:56:50Z
3.14
[]
[ "org.org.assertj.core.util.introspection.PropertyOrFieldSupport_getSimpleValue_with_Map_input_Test" ]
Java
[]
[]
assertj/assertj
1,769
assertj__assertj-1769
[ "1768" ]
089bbe43e39a0933818d98a698eea5d49aeeaedf
diff --git a/src/main/java/org/assertj/core/error/ClassModifierShouldBe.java b/src/main/java/org/assertj/core/error/ClassModifierShouldBe.java --- a/src/main/java/org/assertj/core/error/ClassModifierShouldBe.java +++ b/src/main/java/org/assertj/core/error/ClassModifierShouldBe.java @@ -12,12 +12,13 @@ */ package org...
diff --git a/src/test/java/org/assertj/core/error/ClassModifierShouldBe_create_Test.java b/src/test/java/org/assertj/core/error/ClassModifierShouldBe_create_Test.java --- a/src/test/java/org/assertj/core/error/ClassModifierShouldBe_create_Test.java +++ b/src/test/java/org/assertj/core/error/ClassModifierShouldBe_create...
Trailing space in the modifiers list for ClassModifierShouldBe #### Summary When a class is only `package-private` and a `ClassModifierShouldBe` message is created, the list of modifiers in the failure message contains a trailing space right after the `package-private` value. #### Example Given: ```java clas...
2020-01-30T00:50:43Z
3.15
[]
[ "org.org.assertj.core.error.ClassModifierShouldBe_create_Test" ]
Java
[]
[]
assertj/assertj
1,802
assertj__assertj-1802
[ "1801" ]
0ec343b98c7142f0ff755d17a8e11bbca52fcd70
diff --git a/src/main/java/org/assertj/core/api/AbstractByteArrayAssert.java b/src/main/java/org/assertj/core/api/AbstractByteArrayAssert.java --- a/src/main/java/org/assertj/core/api/AbstractByteArrayAssert.java +++ b/src/main/java/org/assertj/core/api/AbstractByteArrayAssert.java @@ -768,7 +768,7 @@ public SELF using...
diff --git a/src/test/java/org/assertj/core/api/bytearray/ByteArrayAssert_containsExactly_Test.java b/src/test/java/org/assertj/core/api/bytearray/ByteArrayAssert_containsExactly_Test.java --- a/src/test/java/org/assertj/core/api/bytearray/ByteArrayAssert_containsExactly_Test.java +++ b/src/test/java/org/assertj/core/a...
ByteArrayAssert#containsExactly(byte...) error message should state which elements were not found and not expected #### Summary `AbstractByteArrayAssert#containsExactly(byte...)` produces a sub-optimal error message where the expected and actual values are printed out as memory addresses of those arrays, while I would...
2020-03-06T15:35:19Z
3.15
[]
[ "org.org.assertj.core.api.bytearray.ByteArrayAssert_containsExactly_Test" ]
Java
[]
[]
assertj/assertj
1,983
assertj__assertj-1983
[ "1961" ]
8a9712c105031456f046471c81029bbf5baeee25
diff --git a/src/main/java/org/assertj/core/api/Assumptions.java b/src/main/java/org/assertj/core/api/Assumptions.java --- a/src/main/java/org/assertj/core/api/Assumptions.java +++ b/src/main/java/org/assertj/core/api/Assumptions.java @@ -1293,16 +1293,16 @@ protected static <ASSERTION> Class<? extends ASSERTION> gener...
diff --git a/src/test/java/org/assertj/core/api/assumptions/Assumptions_assumeThat_Atomics_Test.java b/src/test/java/org/assertj/core/api/assumptions/Assumptions_assumeThat_Atomics_Test.java --- a/src/test/java/org/assertj/core/api/assumptions/Assumptions_assumeThat_Atomics_Test.java +++ b/src/test/java/org/assertj/cor...
Assumptions.assumeThat incompatible with TestNG 7.1.1+ See https://github.com/cbeust/testng/issues/2352
Thanks for reporting the issue @C-Otto. We could increase the precedence of `org.testng.SkipException` over `org.junit.AssumptionViolatedException`, but I would first wait for a feedback on the TestNG issue you opened. cbeust/testng#2358 should fix this issue.
2020-08-27T19:24:36Z
3.17
[]
[ "org.org.assertj.core.api.recursive.comparison.RecursiveComparisonAssert_assumptions_Test", "org.org.assertj.core.api.bytearray.ByteArrayAssert_asHexString_Test", "org.org.assertj.core.api.bytearray.ByteArrayAssert_asString_Test", "org.org.assertj.core.api.bytearray.ByteArrayAssert_asString_with_charset_Test"...
Java
[]
[]
assertj/assertj
2,012
assertj__assertj-2012
[ "2010" ]
ca806ce21d3d250be8c7af65229aacdf615ce711
diff --git a/src/main/java/org/assertj/core/error/ElementsShouldSatisfy.java b/src/main/java/org/assertj/core/error/ElementsShouldSatisfy.java --- a/src/main/java/org/assertj/core/error/ElementsShouldSatisfy.java +++ b/src/main/java/org/assertj/core/error/ElementsShouldSatisfy.java @@ -68,7 +68,7 @@ public UnsatisfiedR...
diff --git a/src/test/java/org/assertj/core/error/ElementsShouldSatisfy_create_Test.java b/src/test/java/org/assertj/core/error/ElementsShouldSatisfy_create_Test.java --- a/src/test/java/org/assertj/core/error/ElementsShouldSatisfy_create_Test.java +++ b/src/test/java/org/assertj/core/error/ElementsShouldSatisfy_create...
Improve describe error readability of ElementsShouldSatisfy #### Summary The `error: <description>` from `ElementsShouldSatisfy` should be on a new line to improve readability of objects with long `toString()`. #### Example Consider a complex Object with many fields in its `toString`: ```java public class Ob...
Fair enough, go for the PR, thanks!
2020-10-07T01:15:11Z
3.17
[]
[ "org.org.assertj.core.error.ElementsShouldZipSatisfy_create_Test", "org.org.assertj.core.error.ElementsShouldSatisfy_create_Test" ]
Java
[]
[]
assertj/assertj
2,114
assertj__assertj-2114
[ "1949" ]
f27b022a369ba731ed72413f6c10c82a9e539495
diff --git a/src/main/java/org/assertj/core/internal/AtomicReferenceArrayElementComparisonStrategy.java b/src/main/java/org/assertj/core/internal/AtomicReferenceArrayElementComparisonStrategy.java --- a/src/main/java/org/assertj/core/internal/AtomicReferenceArrayElementComparisonStrategy.java +++ b/src/main/java/org/as...
diff --git a/src/test/java/org/assertj/core/internal/StandardComparisonStrategy_areEqual_Test.java b/src/test/java/org/assertj/core/internal/StandardComparisonStrategy_areEqual_Test.java --- a/src/test/java/org/assertj/core/internal/StandardComparisonStrategy_areEqual_Test.java +++ b/src/test/java/org/assertj/core/inte...
#isEqualTo(Object other) takes invalid shortcut #### Summary Before PR #1767 (specifically commit [76762a3664b3af2101d580355a05c6f0b3aa46cc](../commit/76762a3664b3af2101d580355a05c6f0b3aa46cc)) an object x was not automatically considered equal to itself when using `BDDAssertions.assertThat(x).isEqualTo(x);` By switc...
Thanks for the detailed explanation here and in #1948, I will look into them. > Before PR #1767 (specifically commit [76762a3664b3af2101d580355a05c6f0b3aa46cc](../commit/76762a3664b3af2101d580355a05c6f0b3aa46cc)) an object x was not automatically considered equal to itself when using `BDDAssertions.assertThat(x).isEqua...
2021-01-31T16:42:51Z
3.19
[]
[ "org.org.assertj.core.internal.objects.Objects_assertEqual_Test", "org.org.assertj.core.internal.StandardComparisonStrategy_areEqual_Test" ]
Java
[]
[]
assertj/assertj
2,122
assertj__assertj-2122
[ "2111" ]
0f1039f2900602e72c20f67a9e58c30f829b27e0
diff --git a/src/main/java/org/assertj/core/util/introspection/PropertyOrFieldSupport.java b/src/main/java/org/assertj/core/util/introspection/PropertyOrFieldSupport.java --- a/src/main/java/org/assertj/core/util/introspection/PropertyOrFieldSupport.java +++ b/src/main/java/org/assertj/core/util/introspection/PropertyO...
diff --git a/src/test/java/org/assertj/core/api/map/MapAssert_extracting_Test.java b/src/test/java/org/assertj/core/api/map/MapAssert_extracting_Test.java --- a/src/test/java/org/assertj/core/api/map/MapAssert_extracting_Test.java +++ b/src/test/java/org/assertj/core/api/map/MapAssert_extracting_Test.java @@ -13,13 +13...
Assertions ignore missing entry on maps #### Summary A custom assertion extending `MapAssert` that performs a `org.assertj.core.api.AbstractObjectAssert.hasFieldOrProperty(String)` on an `actual` that neither has a getter or field, but _is_ a `Map` silently ignores missing map entries. #### Example Given JSON: ``...
Thanks for the detailed report @rotty3000. is there a particular reason why you are using `hasFieldOrProperty` instead of `containsKey`? The `contains*` API is also demonstrated in JsonUnit's [examples](https://github.com/lukas-krecan/JsonUnit#assertj-integration). Still, it is interesting that `AbstractMapAssert...
2021-02-10T21:09:28Z
3.19
[]
[ "org.org.assertj.core.util.introspection.PropertyOrFieldSupport_getSimpleValue_with_Map_input_Test", "org.org.assertj.core.util.introspection.PropertyOrFieldSupport_getValueOf_Test", "org.org.assertj.core.extractor.ByNameSingleExtractorTest", "org.org.assertj.core.extractor.ByNameMultipleExtractorTest", "or...
Java
[]
[]
assertj/assertj
2,200
assertj__assertj-2200
[ "2199" ]
81ed66f4710138d30e4a4b5ab83ef2989e7f39dd
diff --git a/src/main/java/org/assertj/core/api/Descriptable.java b/src/main/java/org/assertj/core/api/Descriptable.java --- a/src/main/java/org/assertj/core/api/Descriptable.java +++ b/src/main/java/org/assertj/core/api/Descriptable.java @@ -46,7 +46,7 @@ public interface Descriptable<SELF> { * } catch (AssertionE...
diff --git a/src/test/java/org/assertj/core/api/abstract_/AbstractAssert_isInstanceOfSatisfying_Test.java b/src/test/java/org/assertj/core/api/abstract_/AbstractAssert_isInstanceOfSatisfying_Test.java --- a/src/test/java/org/assertj/core/api/abstract_/AbstractAssert_isInstanceOfSatisfying_Test.java +++ b/src/test/java/...
Remove space in default error message for ShouldBeEqual to help IntelliJ diff detection Referencing this StackOverflow ticket: https://stackoverflow.com/questions/10934743/formatting-output-so-that-intellij-idea-shows-diffs-for-two-texts It seems that IntelliJ expects assertion errors to be in this format in order t...
We did that to get values aligned but I guess we can remove that space for intellij idea ``` expected: but was : ``` @rpeng could we do that instead?: ``` expected: but was: ``` @scordio did you have that issue? can you try that second proposal to see if it renders properly? Just tried it out with the seco...
2021-05-06T02:12:01Z
3.19
[]
[ "org.org.assertj.core.matcher.AssertionMatcher_matches_Test", "org.org.assertj.core.api.atomic.reference.AtomicReferenceAssert_hasValueSatisfying_Test", "org.org.assertj.core.api.abstract_.AbstractAssert_isInstanceOfSatisfying_Test", "org.org.assertj.core.error.ShouldBeEqual_newAssertionError_without_JUnit_an...
Java
[]
[]
assertj/assertj
2,203
assertj__assertj-2203
[ "2202" ]
53c8c9a170474d0f134ad247580e3d89469363db
diff --git a/src/main/java/org/assertj/core/error/ShouldNotBe.java b/src/main/java/org/assertj/core/error/ShouldNotBe.java --- a/src/main/java/org/assertj/core/error/ShouldNotBe.java +++ b/src/main/java/org/assertj/core/error/ShouldNotBe.java @@ -35,6 +35,6 @@ public static <T> ErrorMessageFactory shouldNotBe(T actual,...
diff --git a/src/test/java/org/assertj/core/error/ShouldNotBe_create_Test.java b/src/test/java/org/assertj/core/error/ShouldNotBe_create_Test.java --- a/src/test/java/org/assertj/core/error/ShouldNotBe_create_Test.java +++ b/src/test/java/org/assertj/core/error/ShouldNotBe_create_Test.java @@ -34,6 +34,6 @@ void should...
ShouldNotBe: missing linebreak OR to much whitespaces ShouldNotBe has a missing linebreak OR to much whitespaces. https://github.com/assertj/assertj-core/blob/e14081576c22240c45dd2f8f2d3afa7d42303faf/src/main/java/org/assertj/core/error/ShouldNotBe.java#L38 `"%nExpecting actual:%n %s%nnot to be [ ]%s"`
I looks like there is an extra space here ``` to be %s ``` it should be ``` to be %s ``` Just to be sure. https://github.com/assertj/assertj-core/blob/e14081576c22240c45dd2f8f2d3afa7d42303faf/src/main/java/org/assertj/core/error/ShouldNotHave.java Has a linebreak and 2 white spaces. Not sure what th...
2021-05-08T05:52:06Z
3.19
[]
[ "org.org.assertj.core.error.ShouldNotBe_create_Test", "org.org.assertj.core.error.ShouldNotHave_create_Test" ]
Java
[]
[]
assertj/assertj
225
assertj__assertj-225
[ "217" ]
b7c1bc2dc62e4b419f1dd6d896395c7b8d204232
diff --git a/src/main/java/org/assertj/core/internal/Diff.java b/src/main/java/org/assertj/core/internal/Diff.java --- a/src/main/java/org/assertj/core/internal/Diff.java +++ b/src/main/java/org/assertj/core/internal/Diff.java @@ -109,7 +109,7 @@ private BufferedReader readerFor(String string) { private List<Strin...
diff --git a/src/test/java/org/assertj/core/api/SoftAssertionsTest.java b/src/test/java/org/assertj/core/api/SoftAssertionsTest.java --- a/src/test/java/org/assertj/core/api/SoftAssertionsTest.java +++ b/src/test/java/org/assertj/core/api/SoftAssertionsTest.java @@ -168,7 +168,7 @@ public String toString() { a...
Line count should start at 1 instead of 0 when comparing file content In the example below, the first line is not correct, the error should mention line 1 instead of line 0. ``` Caused by: java.lang.AssertionError: File: </home/joel/prog/assertj/assertj-assertions-generator/target/org/assertj/assertions/generator/da...
2014-08-08T22:09:38Z
1.7
[]
[ "org.org.assertj.core.internal.files.Diff_diff_File_String_Test", "org.org.assertj.core.internal.files.Diff_diff_File_Test", "org.org.assertj.core.internal.inputstreams.Diff_diff_InputStream_Test", "org.org.assertj.core.api.SoftAssertionsTest" ]
Java
[]
[]
assertj/assertj
2,324
assertj__assertj-2324
[ "2319" ]
867631539d891c7590f03da4d053b523b5046c32
diff --git a/src/main/java/org/assertj/core/internal/Classes.java b/src/main/java/org/assertj/core/internal/Classes.java --- a/src/main/java/org/assertj/core/internal/Classes.java +++ b/src/main/java/org/assertj/core/internal/Classes.java @@ -431,7 +431,7 @@ private static Set<String> fieldsToName(Set<Field> fields) { ...
diff --git a/src/test/java/org/assertj/core/internal/classes/Classes_assertHasMethods_Test.java b/src/test/java/org/assertj/core/internal/classes/Classes_assertHasMethods_Test.java --- a/src/test/java/org/assertj/core/internal/classes/Classes_assertHasMethods_Test.java +++ b/src/test/java/org/assertj/core/internal/clas...
hasMethods does not work on default methods #### Summary IMO `hasMethod` should really follow the same contract as `Class.getMethod()`, but it doesn't when it comes to default methods inherited from an interface (that are not overridden with an implementation in the class being asserted). This is because `org.ass...
Thanks for reporting this, I agree this should be taken into account. Currently, `hasMethods` doesn't follow `Class::getMethods` not only because of ignoring the default methods but also because it looks into non-public methods declared by `actual` or any of its superclasses. On the other side, `hasDeclaredMethods` ...
2021-08-23T20:36:25Z
3.21
[]
[ "org.org.assertj.core.internal.classes.Classes_assertHasMethods_Test" ]
Java
[]
[]
assertj/assertj
2,364
assertj__assertj-2364
[ "2363" ]
c91eb66ab36c2d733b1c5ec3bcbb5c8b1410278a
diff --git a/src/main/java/org/assertj/core/util/introspection/PropertyOrFieldSupport.java b/src/main/java/org/assertj/core/util/introspection/PropertyOrFieldSupport.java --- a/src/main/java/org/assertj/core/util/introspection/PropertyOrFieldSupport.java +++ b/src/main/java/org/assertj/core/util/introspection/PropertyO...
diff --git a/src/test/java/org/assertj/core/api/object/ObjectAssert_extracting_with_String_Test.java b/src/test/java/org/assertj/core/api/object/ObjectAssert_extracting_with_String_Test.java --- a/src/test/java/org/assertj/core/api/object/ObjectAssert_extracting_with_String_Test.java +++ b/src/test/java/org/assertj/cor...
Extracting through field names not supported for optional in java 17 #### Summary I'm upgrading to java 17 (from java 11), and I have some tests failing due to an incompatibility between java 17 and assertJ. One of the breaking changes introduced by java 17 is [JEP 396: Strongly Encapsulate JDK Internals by Default](...
Thanks for reporting this, we'll check if we can handle `Optional` fields differently. Meanwhile, you could rewrite your assertion in the following way: ```java assertThat(person) .extracting(Person::getName, as(InstanceOfAssertFactories.OPTIONAL)) .hasValue("john"); ``` I'm afraid we will hav...
2021-10-09T21:35:09Z
2.2
[]
[ "org.org.assertj.core.util.introspection.PropertyOrFieldSupport_getSimpleValue_with_Map_input_Test", "org.org.assertj.core.util.introspection.PropertyOrFieldSupport_getSimpleValue_with_Optional_input_Test", "org.org.assertj.core.api.object.ObjectAssert_extracting_with_String_Test" ]
Java
[]
[]
assertj/assertj
2,445
assertj__assertj-2445
[ "2444" ]
2839906331e8a81566d977d75ccf9dd3d19ed19e
diff --git a/src/main/java/org/assertj/core/presentation/StandardRepresentation.java b/src/main/java/org/assertj/core/presentation/StandardRepresentation.java --- a/src/main/java/org/assertj/core/presentation/StandardRepresentation.java +++ b/src/main/java/org/assertj/core/presentation/StandardRepresentation.java @@ -2...
diff --git a/src/test/java/org/assertj/core/presentation/StandardRepresentation_toStringOf_Test.java b/src/test/java/org/assertj/core/presentation/StandardRepresentation_toStringOf_Test.java --- a/src/test/java/org/assertj/core/presentation/StandardRepresentation_toStringOf_Test.java +++ b/src/test/java/org/assertj/cor...
isExactlyInstanceOf gives confusing error message when instance is an anonymous inner class #### Summary When using isExactlyInstanceOf and the actual value is an anonymous inner class, the message is confusing as it claims that the actual value is an "instance of null". #### Example ```java assertThat(x....
Thanks for reporting it, @hjohn. We'll look into it. A small reproducible example would be: ```java Object actual = new Object() {}; assertThat(actual).isNotNull().isExactlyInstanceOf(Object.class); ``` which yields: ``` java.lang.AssertionError: Expecting actual: org.example.MyTest$1@37eeec90 to ...
2021-12-19T11:24:00Z
2.2
[]
[ "org.org.assertj.core.presentation.StandardRepresentation_toStringOf_Test" ]
Java
[]
[]
assertj/assertj
2,549
assertj__assertj-2549
[ "2547" ]
92548d8916425787c8a60e6dea638b285825ca12
diff --git a/src/main/java/org/assertj/core/internal/Maps.java b/src/main/java/org/assertj/core/internal/Maps.java --- a/src/main/java/org/assertj/core/internal/Maps.java +++ b/src/main/java/org/assertj/core/internal/Maps.java @@ -419,6 +419,8 @@ private static <K> Set<K> getNotExpectedKeys(Map<K, ?> actual, K[] expect...
diff --git a/src/test/java/org/assertj/core/internal/maps/Maps_assertContainsOnlyKeys_Test.java b/src/test/java/org/assertj/core/internal/maps/Maps_assertContainsOnlyKeys_Test.java --- a/src/test/java/org/assertj/core/internal/maps/Maps_assertContainsOnlyKeys_Test.java +++ b/src/test/java/org/assertj/core/internal/maps...
Regression in `AbstractMapAssert#containsOnlyKeys` with Spring's `MultiValueMapAdapter` #### Summary We saw this when updating from AssertJ 3.19.0 to 3.20.0. It appears that `AbstractMapAssert#containsOnlyKeys` is mutating the map that we're asserting on, which leads to test failures in our case. This is happening on ...
With a quick look, the only option seems to be performing a check of the fully-qualified class name: if it's `org.springframework.util.MultiValueMapAdapter`, we don't try to clone the map but copy it directly.
2022-03-30T20:25:27Z
2.2
[]
[ "org.org.assertj.core.internal.maps.Maps_assertContainsOnlyKeys_Test", "org.org.assertj.core.internal.maps.Maps_assertContainsOnly_Test" ]
Java
[]
[]
assertj/assertj
2,685
assertj__assertj-2685
[ "2666" ]
d5180a6d7c1af6ac7272268ee87dad54ae01ee7c
diff --git a/src/main/java/org/assertj/core/internal/Strings.java b/src/main/java/org/assertj/core/internal/Strings.java --- a/src/main/java/org/assertj/core/internal/Strings.java +++ b/src/main/java/org/assertj/core/internal/Strings.java @@ -528,8 +528,7 @@ private boolean stringContains(CharSequence actual, CharSeque...
diff --git a/src/test/java/org/assertj/core/internal/strings/Strings_assertContainsIgnoringCase_Test.java b/src/test/java/org/assertj/core/internal/strings/Strings_assertContainsIgnoringCase_Test.java --- a/src/test/java/org/assertj/core/internal/strings/Strings_assertContainsIgnoringCase_Test.java +++ b/src/test/java/...
assertContainsIgnoringCase fails to compare i and I in tr_TR locale See `org.assertj.core.internal.Strings#assertContainsIgnoringCase` https://github.com/assertj/assertj-core/blob/9051a958e6ab0a750bb243060aef57001ab97e6e/src/main/java/org/assertj/core/internal/Strings.java#L528-L531 I would suggest adding https:/...
2022-06-25T14:10:08Z
2.2
[]
[ "org.org.assertj.core.internal.strings.Strings_assertStartsWithIgnoringCase_Test", "org.org.assertj.core.internal.strings.Strings_assertEndsWithIgnoringCase_Test", "org.org.assertj.core.internal.strings.Strings_assertDoesNotContainIgnoringCase_Test", "org.org.assertj.core.internal.strings.Strings_assertNotEqu...
Java
[]
[]
assertj/assertj
2,690
assertj__assertj-2690
[ "2666" ]
de557a731726c5729385f5ca534ccba5f1452e05
diff --git a/assertj-core/src/main/java/org/assertj/core/internal/Strings.java b/assertj-core/src/main/java/org/assertj/core/internal/Strings.java --- a/assertj-core/src/main/java/org/assertj/core/internal/Strings.java +++ b/assertj-core/src/main/java/org/assertj/core/internal/Strings.java @@ -16,6 +16,7 @@ import sta...
diff --git a/assertj-core/src/test/java/org/assertj/core/internal/strings/Strings_assertContainsIgnoringCase_Test.java b/assertj-core/src/test/java/org/assertj/core/internal/strings/Strings_assertContainsIgnoringCase_Test.java --- a/assertj-core/src/test/java/org/assertj/core/internal/strings/Strings_assertContainsIgno...
assertContainsIgnoringCase fails to compare i and I in tr_TR locale See `org.assertj.core.internal.Strings#assertContainsIgnoringCase` https://github.com/assertj/assertj-core/blob/9051a958e6ab0a750bb243060aef57001ab97e6e/src/main/java/org/assertj/core/internal/Strings.java#L528-L531 I would suggest adding https:/...
Reopening as licensing/work attribution aspects are open (see #2688).
2022-06-28T11:53:01Z
3.24
[]
[ "org.Strings assertNotEqualsIgnoringCase", "org.Strings assertContainsIgnoringCase", "org.Strings assertEndsWithIgnoringCase", "org.Strings assertStartsWithIgnoringCase", "org.null", "org.Strings assertDoesNotEndWithIgnoringCase", "org.Strings assertEqualsIgnoringCase", "org.Strings assertDoesNotConta...
Java
[]
[]
assertj/assertj
2,725
assertj__assertj-2725
[ "2724" ]
54fba280ddcd66a852e9f18242705f9bff081c34
diff --git a/assertj-core/src/main/java/org/assertj/core/api/AbstractObjectAssert.java b/assertj-core/src/main/java/org/assertj/core/api/AbstractObjectAssert.java --- a/assertj-core/src/main/java/org/assertj/core/api/AbstractObjectAssert.java +++ b/assertj-core/src/main/java/org/assertj/core/api/AbstractObjectAssert.ja...
diff --git a/assertj-core/src/test/java/org/assertj/core/api/object/ObjectAssert_doesNotReturn_Test.java b/assertj-core/src/test/java/org/assertj/core/api/object/ObjectAssert_doesNotReturn_Test.java --- a/assertj-core/src/test/java/org/assertj/core/api/object/ObjectAssert_doesNotReturn_Test.java +++ b/assertj-core/src/...
`returns` and `doesNotReturn` should honor custom type comparators #### Feature summary Currently, comparators set via `usingComparatorForType` are ignored by `returns` and `doesNotReturn` assertions. We could enhance the implementation so that custom comparators are also used with these two methods. Source: h...
2022-07-30T21:54:26Z
2.2
[]
[ "org.ObjectAssert doesNotReturn", "org.ObjectAssert returns", "org.ObjectAssert extracting with Function" ]
Java
[]
[]
assertj/assertj
3,120
assertj__assertj-3120
[ "3113" ]
2ee04f4a24562a3091af70f815fb07da3ae149ac
diff --git a/assertj-core/src/main/java/org/assertj/core/api/AbstractCharSequenceAssert.java b/assertj-core/src/main/java/org/assertj/core/api/AbstractCharSequenceAssert.java --- a/assertj-core/src/main/java/org/assertj/core/api/AbstractCharSequenceAssert.java +++ b/assertj-core/src/main/java/org/assertj/core/api/Abstr...
diff --git a/assertj-core/src/test/java/org/assertj/core/api/CharSequenceAssertBaseTest.java b/assertj-core/src/test/java/org/assertj/core/api/CharSequenceAssertBaseTest.java --- a/assertj-core/src/test/java/org/assertj/core/api/CharSequenceAssertBaseTest.java +++ b/assertj-core/src/test/java/org/assertj/core/api/CharS...
isEqualToNormalizingWhitespace doesn't normalise non breaking space characters **Describe the bug** isEqualToNormalizingWhitespace doesn't normalise non breaking space characters * assertj core 3.21: * java version: 17 * Kotlin 1.9.0 * test framework version: JUnit 5.9.1 * os (if relevant): **Compare 2 stri...
That's a bit weird since the [implementation](https://github.com/assertj/assertj/blob/776b46c514c4336c58a643fb08bf61a1ac6cb9b3/assertj-core/src/main/java/org/assertj/core/internal/Strings.java#L455) detects the whitespace characters according to the JDK `Character` method [isWhitespace](https://docs.oracle.com/en/java/...
2023-07-24T09:02:08Z
3.25
[]
[ "org.CharSequenceAssert isEqualToNormalizingPunctuationAndWhitespace", "org.Strings assertEqualsNormalizingWhitespace", "org.CharSequenceAssert isNotEqualToNormalizingWhitespace" ]
Java
[]
[]
assertj/assertj
3,224
assertj__assertj-3224
[ "3222" ]
cb7a249ba0146bd5bef04c774df892acb6dd416d
diff --git a/assertj-core/src/main/java/org/assertj/core/api/AbstractObjectAssert.java b/assertj-core/src/main/java/org/assertj/core/api/AbstractObjectAssert.java --- a/assertj-core/src/main/java/org/assertj/core/api/AbstractObjectAssert.java +++ b/assertj-core/src/main/java/org/assertj/core/api/AbstractObjectAssert.ja...
diff --git a/assertj-core/src/test/java/org/assertj/core/api/object/ObjectAssert_doesNotReturn_Test.java b/assertj-core/src/test/java/org/assertj/core/api/object/ObjectAssert_doesNotReturn_Test.java --- a/assertj-core/src/test/java/org/assertj/core/api/object/ObjectAssert_doesNotReturn_Test.java +++ b/assertj-core/src/...
`returns` and `doesNotReturn` should invoke `isNotNull` internally **Describe the bug** The `AbstractObjectAssert#returns(...)` method should assert that the initial `actual` value is not `null`. Instead, it directly applies the `from` function, which then almost always throws a NullPointerException. Compatibility ...
I agree we should guard `returns` and `doesNotReturn` with an `isNotNull` call.
2023-10-16T16:38:37Z
3.25
[]
[ "org.ObjectAssert returns", "org.ObjectAssert doesNotReturn" ]
Java
[]
[]
assertj/assertj
3,321
assertj__assertj-3321
[ "3315", "3317" ]
2a7c5a6e205e29d42e9886657987893cb03b6875
diff --git a/assertj-core/src/main/java/org/assertj/core/internal/Maps.java b/assertj-core/src/main/java/org/assertj/core/internal/Maps.java --- a/assertj-core/src/main/java/org/assertj/core/internal/Maps.java +++ b/assertj-core/src/main/java/org/assertj/core/internal/Maps.java @@ -440,10 +440,6 @@ private static <K, V...
diff --git a/assertj-core/src/test/java/org/assertj/core/internal/MapsBaseTest.java b/assertj-core/src/test/java/org/assertj/core/internal/MapsBaseTest.java --- a/assertj-core/src/test/java/org/assertj/core/internal/MapsBaseTest.java +++ b/assertj-core/src/test/java/org/assertj/core/internal/MapsBaseTest.java @@ -70,9 ...
AssertJ cannot compare arrays in maps **Describe the bug** A clear and concise description of what the bug is. * assertj core version: 3.25.0 * java version: 17 * test framework version: JUnit 5.10.1 * os (if relevant): MacOS Sonoma 14.2.1 **Test case reproducing the bug** This code worked in AssertJ 3.24....
Thanks for reporting it, @asolntsev! The change that causes the issue is 498ee5bb0a5cc367420cdb3c8e0e93d6e4bf5e51. Here we assume that the map value can be compared with `equals`: https://github.com/assertj/assertj/blob/25347d57bb28295548ec6bd5b06e70b6d03496c9/assertj-core/src/main/java/org/assertj/core/internal/Map...
2024-01-02T23:07:30Z
3.25
[]
[ "org.Maps assertContainsExactly", "org.Maps assertContainsKeys" ]
Java
[]
[]
assertj/assertj
3,467
assertj__assertj-3467
[ "3359" ]
8f3091e46756f3ca80f7d84ca5875912fa8b2adf
diff --git a/assertj-core/src/main/java/org/assertj/core/api/AbstractDateAssert.java b/assertj-core/src/main/java/org/assertj/core/api/AbstractDateAssert.java --- a/assertj-core/src/main/java/org/assertj/core/api/AbstractDateAssert.java +++ b/assertj-core/src/main/java/org/assertj/core/api/AbstractDateAssert.java @@ -2...
diff --git a/assertj-core/src/test/java/org/assertj/core/api/date/DateAssert_isEqualTo_Test.java b/assertj-core/src/test/java/org/assertj/core/api/date/DateAssert_isEqualTo_Test.java --- a/assertj-core/src/test/java/org/assertj/core/api/date/DateAssert_isEqualTo_Test.java +++ b/assertj-core/src/test/java/org/assertj/co...
Unable to compare some timestamp types **Describe the bug** A clear and concise description of what the bug is. * assertj core version: 3.25.3 * java version: 21.0.1-open * test framework version: JUnit 5.10.2 * os (if relevant): Linux 6.5.0-15-generic # 15-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 9 17:03:36 UTC 202...
Thanks for reporting it, @IUSR. The root cause is the usage of `Date.from(Instant)` internally, which doesn't behave correctly when `actual` is a `Timestamp`. As a workaround, you can rely on [`Timestamp.from(Instant)`](https://docs.oracle.com/javase/8/docs/api/java/sql/Timestamp.html#from-java.time.Instant-): ...
2024-05-09T16:26:16Z
3.26
[]
[ "org.StandardComparisonStrategy areEqual", "org.DateAssert isEqualTo With String", "org.DateAssert isEqualTo With Instant", "org.DateAssert isEqualTo With Object", "org.DateAssert isEqualTo" ]
Java
[]
[]
assertj/assertj
656
assertj__assertj-656
[ "655" ]
319d0ce078adfd83575c15b21b7916470fe46d10
diff --git a/src/main/java/org/assertj/core/api/IterableAssert.java b/src/main/java/org/assertj/core/api/IterableAssert.java --- a/src/main/java/org/assertj/core/api/IterableAssert.java +++ b/src/main/java/org/assertj/core/api/IterableAssert.java @@ -120,6 +120,24 @@ public IterableAssert<T> isNotExactlyInstanceOf(Clas...
diff --git a/src/test/java/org/assertj/core/api/Assertions_assertThat_with_Iterator_Test.java b/src/test/java/org/assertj/core/api/Assertions_assertThat_with_Iterator_Test.java --- a/src/test/java/org/assertj/core/api/Assertions_assertThat_with_Iterator_Test.java +++ b/src/test/java/org/assertj/core/api/Assertions_asse...
IterableAssert should override isSameAs and isNotSameAs to unroll the actual instance. #### Summary IterableAssert does not override the methods to unroll the actual instance. #### Real life use case or example ``` @Test public void testIterator() { Iterator<String> iterator = new ArrayList<String>().iterator();...
2016-05-02T13:04:13Z
3.5
[]
[ "org.org.assertj.core.api.Assertions_assertThat_with_Iterator_Test" ]
Java
[]
[]
assertj/assertj
813
assertj__assertj-813
[ "812" ]
d517f7761f4f7a13e86aa04c3f1aa8584fef881a
diff --git a/src/main/java/org/assertj/core/error/OptionalShouldContainInstanceOf.java b/src/main/java/org/assertj/core/error/OptionalShouldContainInstanceOf.java --- a/src/main/java/org/assertj/core/error/OptionalShouldContainInstanceOf.java +++ b/src/main/java/org/assertj/core/error/OptionalShouldContainInstanceOf.ja...
diff --git a/src/test/java/org/assertj/core/error/OptionalShouldContainInstanceOf_create_Test.java b/src/test/java/org/assertj/core/error/OptionalShouldContainInstanceOf_create_Test.java --- a/src/test/java/org/assertj/core/error/OptionalShouldContainInstanceOf_create_Test.java +++ b/src/test/java/org/assertj/core/erro...
Improve error message for "optional.containsInstanceOf(clazz)" #### Summary The error message for OptionalAssert.containsInstanceOf() is less descriptive than the similar message for AbstractAssert.isInstanceOf. Pull request is in the works. #### Example Before change: ```java Expecting Optional to contain...
2016-11-28T11:27:01Z
3.6
[]
[ "org.org.assertj.core.error.OptionalShouldContainInstanceOf_create_Test" ]
Java
[]
[]
pyca/cryptography
4,819
pyca__cryptography-4819
[ "4818" ]
d21f8815a11972b804a776b4201dc4867bf8ce4c
diff --git a/src/cryptography/x509/extensions.py b/src/cryptography/x509/extensions.py --- a/src/cryptography/x509/extensions.py +++ b/src/cryptography/x509/extensions.py @@ -856,11 +856,35 @@ def __hash__(self): class OCSPNoCheck(object): oid = ExtensionOID.OCSP_NO_CHECK + def __eq__(self, other): + ...
diff --git a/tests/x509/test_x509_ext.py b/tests/x509/test_x509_ext.py --- a/tests/x509/test_x509_ext.py +++ b/tests/x509/test_x509_ext.py @@ -4391,6 +4391,28 @@ def test_nocheck(self, backend): ) assert isinstance(ext.value, x509.OCSPNoCheck) + def test_eq(self): + onc1 = x509.OCSPNoCheck...
PrecertPoison and OCSPNoCheck do not compare as equal Given the same input parameters, two extension instances usually compare as equal: ``` >>> x509.OCSPNonce(b'foo') == x509.OCSPNonce(b'foo') True >>> x509.SubjectKeyIdentifier(b'333333') == x509.SubjectKeyIdentifier(b'333333') True ``` However this does no...
Those two extensions don't implement `__eq__`. They're empty extensions with no value so I wouldn't have thought comparison would be particularly useful, but that doesn't make me right. 😄 However, if we implement `__eq__` we'll make the class unhashable so we also need to implement `__hash__`. And we'll need to im...
2019-03-22T17:12:45Z
2.7
[ "tests/x509/test_x509_ext.py::TestExtension::test_not_an_oid", "tests/x509/test_x509_ext.py::TestExtension::test_critical_not_a_bool", "tests/x509/test_x509_ext.py::TestExtension::test_repr", "tests/x509/test_x509_ext.py::TestExtension::test_eq", "tests/x509/test_x509_ext.py::TestExtension::test_ne", "tes...
[ "tests/x509/test_x509_ext.py::TestOCSPNoCheckExtension::test_eq", "tests/x509/test_x509_ext.py::TestOCSPNoCheckExtension::test_hash", "tests/x509/test_x509_ext.py::TestOCSPNoCheckExtension::test_repr", "tests/x509/test_x509_ext.py::TestPrecertPoisonExtension::test_eq", "tests/x509/test_x509_ext.py::TestPrec...
Python
[]
[]
pyca/cryptography
4,853
pyca__cryptography-4853
[ "4817" ]
acada96664f0b226b8fa3e7192eb0d008367e1f1
diff --git a/src/cryptography/x509/oid.py b/src/cryptography/x509/oid.py --- a/src/cryptography/x509/oid.py +++ b/src/cryptography/x509/oid.py @@ -196,6 +196,7 @@ class CertificatePoliciesOID(object): ExtensionOID.PRECERT_SIGNED_CERTIFICATE_TIMESTAMPS: ( "signedCertificateTimestampList" ), + Exten...
diff --git a/tests/x509/test_x509_ext.py b/tests/x509/test_x509_ext.py --- a/tests/x509/test_x509_ext.py +++ b/tests/x509/test_x509_ext.py @@ -23,7 +23,7 @@ from cryptography.x509.general_name import _lazy_import_idna from cryptography.x509.oid import ( AuthorityInformationAccessOID, ExtendedKeyUsageOID, Extensi...
PrecertPoison ExtensionOID has no name In cryptography 2.6.1, the PrecertPoison extension has no name defined: ``` >>> import cryptography >>> cryptography.__version__ '2.6.1' >>> from cryptography.x509.oid import ExtensionOID >>> ExtensionOID.KEY_USAGE <ObjectIdentifier(oid=2.5.29.15, name=keyUsage)> >>> Ex...
We should add that to `x509.oid._OID_NAMES`. Are you aware of a camelCase style name? I don't see one in the typical OID registries. Hooray non-canonical friendly names... > Are you aware of a camelCase style name? If you mean if I'm aware of a standard that mandates these names: I'm not aware of any. btw, maybe ...
2019-04-20T00:14:10Z
2.7
[ "tests/x509/test_x509_ext.py::TestExtension::test_not_an_oid", "tests/x509/test_x509_ext.py::TestExtension::test_critical_not_a_bool", "tests/x509/test_x509_ext.py::TestExtension::test_repr", "tests/x509/test_x509_ext.py::TestExtension::test_eq", "tests/x509/test_x509_ext.py::TestExtension::test_ne", "tes...
[ "tests/x509/test_x509_ext.py::test_all_extension_oid_members_have_names_defined" ]
Python
[]
[]
pyca/cryptography
4,864
pyca__cryptography-4864
[ "4863" ]
bc081087c8d079597787ad0b36245a03de346681
diff --git a/src/cryptography/utils.py b/src/cryptography/utils.py --- a/src/cryptography/utils.py +++ b/src/cryptography/utils.py @@ -23,6 +23,7 @@ class CryptographyDeprecationWarning(UserWarning): PersistentlyDeprecated2017 = CryptographyDeprecationWarning PersistentlyDeprecated2018 = CryptographyDeprecationWarnin...
diff --git a/tests/x509/test_x509_ext.py b/tests/x509/test_x509_ext.py --- a/tests/x509/test_x509_ext.py +++ b/tests/x509/test_x509_ext.py @@ -3196,11 +3196,18 @@ def test_from_issuer_subject_key_identifier(self, backend): ext = cert.extensions.get_extension_for_oid( ExtensionOID.AUTHORITY_KEY_IDE...
AuthorityKeyIdentifier.from_issuer_subject_key_identifier takes the wrong object Found by randomly browsing: https://github.com/Netflix/lemur/blob/73ac1591e015fb576c2a53954f64f422472a15dd/lemur/plugins/lemur_cryptography/plugin.py#L87-L91 The bug here is that the function (and our test) assume that you're passing a...
2019-05-01T12:34:10Z
2.7
[ "tests/x509/test_x509_ext.py::TestExtension::test_not_an_oid", "tests/x509/test_x509_ext.py::TestExtension::test_critical_not_a_bool", "tests/x509/test_x509_ext.py::TestExtension::test_repr", "tests/x509/test_x509_ext.py::TestExtension::test_eq", "tests/x509/test_x509_ext.py::TestExtension::test_ne", "tes...
[ "tests/x509/test_x509_ext.py::TestAuthorityKeyIdentifierExtension::test_from_issuer_subject_key_identifier" ]
Python
[]
[]
pyca/cryptography
5,022
pyca__cryptography-5022
[ "5018" ]
a1307a1f34e4f6f8f124cde92ec53c4cd0580078
diff --git a/src/cryptography/hazmat/bindings/openssl/binding.py b/src/cryptography/hazmat/bindings/openssl/binding.py --- a/src/cryptography/hazmat/bindings/openssl/binding.py +++ b/src/cryptography/hazmat/bindings/openssl/binding.py @@ -5,6 +5,7 @@ from __future__ import absolute_import, division, print_function ...
diff --git a/tests/hazmat/bindings/test_openssl.py b/tests/hazmat/bindings/test_openssl.py --- a/tests/hazmat/bindings/test_openssl.py +++ b/tests/hazmat/bindings/test_openssl.py @@ -4,11 +4,14 @@ from __future__ import absolute_import, division, print_function +import pretend + import pytest from cryptography...
Implement env var for OpenSSL 1.0.1 support As part of #4923 we need to add `CRYPTOGRAPHY_ALLOW_OPENSSL_101` and update CI to test using that.
2019-10-18T02:05:46Z
2.9
[ "tests/hazmat/bindings/test_openssl.py::TestOpenSSL::test_binding_loads", "tests/hazmat/bindings/test_openssl.py::TestOpenSSL::test_crypto_lock_init", "tests/hazmat/bindings/test_openssl.py::TestOpenSSL::test_add_engine_more_than_once", "tests/hazmat/bindings/test_openssl.py::TestOpenSSL::test_ssl_ctx_options...
[ "tests/hazmat/bindings/test_openssl.py::TestOpenSSL::test_verify_openssl_version" ]
Python
[]
[]
pyca/cryptography
5,307
pyca__cryptography-5307
[ "4706" ]
4ef460abb2ca5dafa245f685f4b76e704567cca1
diff --git a/src/cryptography/hazmat/backends/openssl/rsa.py b/src/cryptography/hazmat/backends/openssl/rsa.py --- a/src/cryptography/hazmat/backends/openssl/rsa.py +++ b/src/cryptography/hazmat/backends/openssl/rsa.py @@ -314,6 +314,11 @@ def verify(self): @utils.register_interface(RSAPrivateKeyWithSerialization) cl...
diff --git a/tests/hazmat/primitives/fixtures_rsa.py b/tests/hazmat/primitives/fixtures_rsa.py --- a/tests/hazmat/primitives/fixtures_rsa.py +++ b/tests/hazmat/primitives/fixtures_rsa.py @@ -784,3 +784,33 @@ ), ), ) + +RSA_KEY_CORRUPTED = b""" +-----BEGIN RSA PRIVATE KEY----- +MIIEpQIBAAKCAQEAuYE4k09MAsi...
Internal assertion error on some corrupt private keys This has popped up since cryptography 2.x and was discovered in our unit tests where we test for signing JWTs with malformed/corrupted/invalid private keys. The way we constructed these bad private keys was to take a valid private key and replace the `a` bytes with ...
You're generating the initial key with pycrypto (which is a dependency you don't need since you've got cryptography installed of course), but the more interesting issue is that the following provides different signatures every loop (except when it errors!): ```python from cryptography.hazmat.backends.openssl.backen...
2020-07-12T15:26:21Z
3.1
[ "tests/hazmat/primitives/test_rsa.py::test_check_rsa_private_numbers_if_serializable", "tests/hazmat/primitives/test_rsa.py::test_skip_pss_hash_algorithm_unsupported", "tests/hazmat/primitives/test_rsa.py::test_modular_inverse", "tests/hazmat/primitives/test_rsa.py::TestRSA::test_generate_rsa_keys[3-1024]", ...
[ "tests/hazmat/primitives/test_rsa.py::TestRSASignature::test_corrupted_private_key" ]
Python
[]
[]
pyca/cryptography
5,314
pyca__cryptography-5314
[ "5127" ]
40e42fa65fade9d701dd2d3cf908e67c1e0aa916
diff --git a/src/cryptography/x509/extensions.py b/src/cryptography/x509/extensions.py --- a/src/cryptography/x509/extensions.py +++ b/src/cryptography/x509/extensions.py @@ -1054,8 +1054,11 @@ def __repr__(self): encipher_only = self.encipher_only decipher_only = self.decipher_only e...
diff --git a/tests/x509/test_x509_ext.py b/tests/x509/test_x509_ext.py --- a/tests/x509/test_x509_ext.py +++ b/tests/x509/test_x509_ext.py @@ -896,8 +896,8 @@ def test_repr_key_agreement_false(self): assert repr(ku) == ( "<KeyUsage(digital_signature=True, content_commitment=True, key_en" ...
Doc mistake in example. Example for extentions [here](https://cryptography.io/en/latest/x509/reference/#cryptography.x509.Certificate.extensions) contains errors: ` <Extension(oid=<ObjectIdentifier(oid=2.5.29.15, name=keyUsage)>, critical=True, value=<KeyUsage(digital_signature=False, content_commitment=False, key_e...
This is perhaps a bit confusing but is not a bug in the docs. The `__repr__` shown there says None because in this case `encipher_only` and `decipher_only` have no meaning when `key_agreement` is not `True`. We represent this in the repr by saying `None`, but `None` is not allowed in the `__init__` of the class itself....
2020-07-18T22:14:30Z
3.0
[ "tests/x509/test_x509_ext.py::TestExtension::test_not_an_oid", "tests/x509/test_x509_ext.py::TestExtension::test_critical_not_a_bool", "tests/x509/test_x509_ext.py::TestExtension::test_repr", "tests/x509/test_x509_ext.py::TestExtension::test_eq", "tests/x509/test_x509_ext.py::TestExtension::test_ne", "tes...
[ "tests/x509/test_x509_ext.py::TestKeyUsage::test_repr_key_agreement_false" ]
Python
[]
[]
pyca/cryptography
5,438
pyca__cryptography-5438
[ "5432" ]
1fd7cacdb8675242bb8438cf427b9417dcea6968
diff --git a/src/cryptography/hazmat/bindings/openssl/binding.py b/src/cryptography/hazmat/bindings/openssl/binding.py --- a/src/cryptography/hazmat/bindings/openssl/binding.py +++ b/src/cryptography/hazmat/bindings/openssl/binding.py @@ -5,6 +5,7 @@ from __future__ import absolute_import, division, print_function ...
diff --git a/tests/hazmat/bindings/test_openssl.py b/tests/hazmat/bindings/test_openssl.py --- a/tests/hazmat/bindings/test_openssl.py +++ b/tests/hazmat/bindings/test_openssl.py @@ -4,6 +4,8 @@ from __future__ import absolute_import, division, print_function +import pretend + import pytest from cryptography.e...
Make OpenSSL 1.0.2 error (+ env var fallback)
2020-08-27T23:21:56Z
3.2
[ "tests/hazmat/bindings/test_openssl.py::TestOpenSSL::test_binding_loads", "tests/hazmat/bindings/test_openssl.py::TestOpenSSL::test_crypto_lock_init", "tests/hazmat/bindings/test_openssl.py::TestOpenSSL::test_add_engine_more_than_once", "tests/hazmat/bindings/test_openssl.py::TestOpenSSL::test_ssl_ctx_options...
[ "tests/hazmat/bindings/test_openssl.py::TestOpenSSL::test_verify_openssl_version" ]
Python
[]
[]
pyca/cryptography
5,462
pyca__cryptography-5462
[ "4805" ]
3367c18bf2e71639843e38498f5ad2159835122d
diff --git a/src/cryptography/hazmat/primitives/padding.py b/src/cryptography/hazmat/primitives/padding.py --- a/src/cryptography/hazmat/primitives/padding.py +++ b/src/cryptography/hazmat/primitives/padding.py @@ -40,9 +40,9 @@ def _byte_padding_update(buffer_, data, block_size): if buffer_ is None: rais...
diff --git a/tests/hazmat/primitives/test_padding.py b/tests/hazmat/primitives/test_padding.py --- a/tests/hazmat/primitives/test_padding.py +++ b/tests/hazmat/primitives/test_padding.py @@ -109,6 +109,18 @@ def test_large_padding(self): assert data == b"" + def test_bytearray(self): + padder = p...
Allow bytearray in padding and unpadding It looks like in the padding code, it requires the data passed to padding and unpadding to be bytes, and does not allow bytearray's. I saw in #4409 that bytes like objects were allowed as key material and such, does it make sense to allow them to be given to padders and unpadder...
Allowing buffers in padding seems reasonable -- though it's kind of pointless unless we change the internals of the padders, which would make tons of copies as currently written. I don't quite follow? The point of allowing buffers is that you can clear the memory, and thus be resillient to memory disclosure vulnerabili...
2020-09-13T13:40:35Z
3.2
[ "tests/hazmat/primitives/test_padding.py::TestPKCS7::test_invalid_block_size[127]", "tests/hazmat/primitives/test_padding.py::TestPKCS7::test_invalid_block_size[4096]", "tests/hazmat/primitives/test_padding.py::TestPKCS7::test_invalid_block_size[-2]", "tests/hazmat/primitives/test_padding.py::TestPKCS7::test_...
[ "tests/hazmat/primitives/test_padding.py::TestPKCS7::test_bytearray", "tests/hazmat/primitives/test_padding.py::TestANSIX923::test_bytearray" ]
Python
[]
[]
pyca/cryptography
5,498
pyca__cryptography-5498
[ "5492" ]
95c4f68c1b50b8eb84a0f3268bc6fdbd08e20f08
diff --git a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py --- a/src/cryptography/hazmat/backends/openssl/backend.py +++ b/src/cryptography/hazmat/backends/openssl/backend.py @@ -2695,6 +2695,15 @@ def pkcs7_sign(self, builder, encoding, options): ini...
diff --git a/tests/hazmat/primitives/test_pkcs7.py b/tests/hazmat/primitives/test_pkcs7.py --- a/tests/hazmat/primitives/test_pkcs7.py +++ b/tests/hazmat/primitives/test_pkcs7.py @@ -607,3 +607,52 @@ def test_multiple_signers_different_hash_algs(self, backend): options, backend, ) + +...
Add additional x509 certificate to SMIMESignatureBuilder As mentioned in #5433: It would be great to be able to add an additional certificate when using the new SMIMESignatureBuilder API. The background is that my x509 certificate is from a commercial CA. But - as it's commonly the case - it is not signed directly ...
2020-10-25T04:04:24Z
3.2
[ "tests/hazmat/primitives/test_pkcs7.py::TestPKCS7Loading::test_load_invalid_der_pkcs7", "tests/hazmat/primitives/test_pkcs7.py::TestPKCS7Loading::test_load_invalid_pem_pkcs7", "tests/hazmat/primitives/test_pkcs7.py::TestPKCS7Loading::test_not_bytes_der", "tests/hazmat/primitives/test_pkcs7.py::TestPKCS7Loadin...
[ "tests/hazmat/primitives/test_pkcs7.py::TestPKCS7Builder::test_add_additional_cert_not_a_cert", "tests/hazmat/primitives/test_pkcs7.py::TestPKCS7Builder::test_add_additional_cert", "tests/hazmat/primitives/test_pkcs7.py::TestPKCS7Builder::test_add_multiple_additional_certs" ]
Python
[]
[]
pyca/cryptography
5,594
pyca__cryptography-5594
[ "4531" ]
f133a3029a56d869084bc9839131bd57283027e0
diff --git a/src/_cffi_src/openssl/ct.py b/src/_cffi_src/openssl/ct.py --- a/src/_cffi_src/openssl/ct.py +++ b/src/_cffi_src/openssl/ct.py @@ -50,13 +50,14 @@ int SCT_set_source(SCT *, sct_source_t); +Cryptography_STACK_OF_SCT *sk_SCT_new_null(void); +void sk_SCT_free(Cryptography_STACK_OF_SCT *); int sk_SCT_num(...
diff --git a/tests/x509/test_x509_ext.py b/tests/x509/test_x509_ext.py --- a/tests/x509/test_x509_ext.py +++ b/tests/x509/test_x509_ext.py @@ -5678,6 +5678,33 @@ def test_simple(self, backend): == x509.certificate_transparency.LogEntryType.PRE_CERTIFICATE ) + @pytest.mark.supported( + ...
Support encoding SCT data into an X.509 extension Continued from #3461 since we've done everything but encoding them and it turns out that's more than a bit of a pain.
Since this has come up again in #4820: @alex didn't you run into some significant problems with SCT creation for reasons I no longer recall but hopefully you do?
2020-11-30T15:50:22Z
3.3
[ "tests/x509/test_x509_ext.py::TestExtension::test_not_an_oid", "tests/x509/test_x509_ext.py::TestExtension::test_critical_not_a_bool", "tests/x509/test_x509_ext.py::TestExtension::test_repr", "tests/x509/test_x509_ext.py::TestExtension::test_eq", "tests/x509/test_x509_ext.py::TestExtension::test_ne", "tes...
[ "tests/x509/test_x509_ext.py::TestPrecertificateSignedCertificateTimestampsExtension::test_generate" ]
Python
[]
[]
pyca/cryptography
5,849
pyca__cryptography-5849
[ "5848" ]
2b94360394a4fa177701954f96f864cfa7c65b9f
diff --git a/src/cryptography/x509/extensions.py b/src/cryptography/x509/extensions.py --- a/src/cryptography/x509/extensions.py +++ b/src/cryptography/x509/extensions.py @@ -288,6 +288,10 @@ def from_public_key( def digest(self) -> bytes: return self._digest + @property + def key_identifier(self)...
diff --git a/tests/x509/test_x509_ext.py b/tests/x509/test_x509_ext.py --- a/tests/x509/test_x509_ext.py +++ b/tests/x509/test_x509_ext.py @@ -994,6 +994,7 @@ def test_properties(self): value = binascii.unhexlify(b"092384932230498bc980aa8098456f6ff7ff3ac9") ski = x509.SubjectKeyIdentifier(value) ...
x509 AuthorityKeyIdentifier and SubjectKeyIdentifier have inconsistent APIs [x509.AuthorityKeyIdentifier]( https://github.com/pyca/cryptography/blob/96801ff92e861c8ee333c14afda691d1025e5e8f/src/cryptography/x509/extensions.py#L172) and [x509.SubjectKeyIdentifier]( https://github.com/pyca/cryptography/blob/96801ff92e8...
2021-02-19T00:44:23Z
35.0
[ "tests/x509/test_x509_ext.py::TestExtension::test_not_an_oid", "tests/x509/test_x509_ext.py::TestCertificatePoliciesExtension::test_cps_uri_policy_qualifier", "tests/x509/test_x509_ext.py::TestUserNotice::test_notice_reference_invalid", "tests/x509/test_x509_ext.py::TestCertificateIssuer::test_get_values_for_...
[ "tests/x509/test_x509_ext.py::TestSubjectKeyIdentifier::test_properties" ]
Python
[]
[]
pyca/cryptography
5,879
pyca__cryptography-5879
[ "5872" ]
f69f27b1dd20ad2d24f48053a72545527e808104
diff --git a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py --- a/src/cryptography/hazmat/backends/openssl/backend.py +++ b/src/cryptography/hazmat/backends/openssl/backend.py @@ -2524,7 +2524,9 @@ def load_key_and_certificates_from_pkcs12(self, data, password)...
diff --git a/tests/hazmat/primitives/test_pkcs12.py b/tests/hazmat/primitives/test_pkcs12.py --- a/tests/hazmat/primitives/test_pkcs12.py +++ b/tests/hazmat/primitives/test_pkcs12.py @@ -4,13 +4,15 @@ import os +from datetime import datetime import pytest from cryptography import x509 from cryptography.hazm...
PKCS#12 ordering is reversed Although the PKCS#12 APIs in cryptography.io are consistent with each other, they're reversed from what's actually in the file. This logic reverses the order into `PKCS12_create`. https://github.com/pyca/cryptography/blob/5511445e95a16fa12b464d57ace4bb17855fe844/src/cryptography/hazmat/bac...
2021-02-28T20:47:38Z
35.0
[ "tests/hazmat/primitives/test_pkcs12.py::TestPKCS12Loading::test_non_bytes", "tests/hazmat/primitives/test_pkcs12.py::TestPKCS12Loading::test_load_pkcs12_cert_only", "tests/hazmat/primitives/test_pkcs12.py::TestPKCS12Loading::test_not_a_pkcs12", "tests/hazmat/primitives/test_pkcs12.py::TestPKCS12Loading::test...
[ "tests/hazmat/primitives/test_pkcs12.py::test_pkcs12_ordering" ]
Python
[]
[]
pyca/cryptography
5,925
pyca__cryptography-5925
[ "5885" ]
d95bf3277b893ce64b979ce8da83521aeb80fce0
diff --git a/src/cryptography/hazmat/backends/openssl/ciphers.py b/src/cryptography/hazmat/backends/openssl/ciphers.py --- a/src/cryptography/hazmat/backends/openssl/ciphers.py +++ b/src/cryptography/hazmat/backends/openssl/ciphers.py @@ -145,7 +145,13 @@ def update_into(self, data: bytes, buf) -> int: res...
diff --git a/tests/hazmat/primitives/test_aes.py b/tests/hazmat/primitives/test_aes.py --- a/tests/hazmat/primitives/test_aes.py +++ b/tests/hazmat/primitives/test_aes.py @@ -52,6 +52,14 @@ def test_xts_vectors(self, backend, subtests): computed_pt = dec.update(ct) + dec.finalize() ass...
AES-XTS failing for plaintext less then 16 bytes I am using version 2.6.1 (Python 2) Encrypting plaintext less then 16 bytes in AES XTS mode throws the following exception: > "_cryptography.exceptions.InternalError: Unknown OpenSSL error. This error is commonly encountered when another library is not cleaning up th...
XTS is defined (see: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38e.pdf) for encrypting any data that consists of one or more complete blocks (128-bit since the underlying AES is a 128-bit block cipher) + a single partial block. So byte sizes 1-15 are invalid for XTS. Ideally we would catch t...
2021-03-21T23:27:51Z
35.0
[ "tests/hazmat/primitives/test_aes.py::TestAESModeXTS::test_xts_vectors", "tests/hazmat/primitives/test_aes.py::test_buffer_protocol_alternate_modes[mode0]", "tests/hazmat/primitives/test_aes.py::test_buffer_protocol_alternate_modes[mode1]", "tests/hazmat/primitives/test_aes.py::test_buffer_protocol_alternate_...
[ "tests/hazmat/primitives/test_aes.py::TestAESModeXTS::test_xts_too_short" ]
Python
[]
[]
pyca/cryptography
6,085
pyca__cryptography-6085
[ "5998" ]
5565587b0b03e067a0c2f701884504cfae384886
diff --git a/src/_cffi_src/openssl/cryptography.py b/src/_cffi_src/openssl/cryptography.py --- a/src/_cffi_src/openssl/cryptography.py +++ b/src/_cffi_src/openssl/cryptography.py @@ -41,6 +41,8 @@ #define CRYPTOGRAPHY_OPENSSL_110F_OR_GREATER \ (OPENSSL_VERSION_NUMBER >= 0x1010006f && !CRYPTOGRAPHY_IS_LIBRESSL) ...
diff --git a/tests/hazmat/primitives/test_aes.py b/tests/hazmat/primitives/test_aes.py --- a/tests/hazmat/primitives/test_aes.py +++ b/tests/hazmat/primitives/test_aes.py @@ -60,6 +60,19 @@ def test_xts_too_short(self): with pytest.raises(ValueError): enc.update(b"0" * 15) + @pytest.mark.supp...
openssl aes "xts duplicated keys" error is reported as "Unknown OpenSSL Error" Recent versions of openssl [explicitly reject duplicated AES-XTS keys](https://github.com/openssl/openssl/blob/c39352/crypto/evp/e_aes.c#L3119). Cryptography openssl backend reports this as an Unknown OpenSSL Error. * Versions of Python, ...
Extra thing-to-maybe-care-about is that in non-FIPS mode, openssl allows the duplicate key for decrypting. So it might be reasonable to do the check in Python but only if encrypting? or do the checks in the Python side of the backend and match the FIPS/not-FIPS logic in Python? I think handling the `EVP_R_XTS_DUPLICATE...
2021-06-03T09:19:29Z
35.0
[ "tests/hazmat/primitives/test_aes.py::TestAESModeXTS::test_xts_vectors", "tests/hazmat/primitives/test_aes.py::TestAESModeXTS::test_xts_too_short", "tests/hazmat/primitives/test_aes.py::test_buffer_protocol_alternate_modes[mode0]", "tests/hazmat/primitives/test_aes.py::test_buffer_protocol_alternate_modes[mod...
[ "tests/hazmat/primitives/test_aes.py::TestAESModeXTS::test_xts_no_duplicate_keys_encryption" ]
Python
[]
[]
pyca/cryptography
6,246
pyca__cryptography-6246
[ "6244" ]
905fa95de679738e0e64a59a8ce98e47b12e364c
diff --git a/src/cryptography/hazmat/backends/openssl/ciphers.py b/src/cryptography/hazmat/backends/openssl/ciphers.py --- a/src/cryptography/hazmat/backends/openssl/ciphers.py +++ b/src/cryptography/hazmat/backends/openssl/ciphers.py @@ -238,12 +238,19 @@ def finalize(self) -> bytes: return self._backend._ffi...
diff --git a/tests/hazmat/primitives/test_aes_gcm.py b/tests/hazmat/primitives/test_aes_gcm.py --- a/tests/hazmat/primitives/test_aes_gcm.py +++ b/tests/hazmat/primitives/test_aes_gcm.py @@ -168,12 +168,13 @@ def test_gcm_tag_decrypt_finalize(self, backend): decryptor.finalize_with_tag(tag) - def test_g...
Unknown OpenSSL error with latest python docker image I'm seeing the following openssl error when I'm trying to use cryptography for aes-gcm. Attached are the detailed steps for repro and the results from my terminal. The outputs also contain the versions of python, openssl and cryptography. # Repro ## Detailed R...
Thanks for the bug report. The issue here is that you are passing a 24 byte tag. GCM tags are, at most, 16 bytes. This is still a bug in our library though because we should catch this and raise a `ValueError` instead.
2021-08-30T03:56:26Z
35.0
[ "tests/hazmat/primitives/test_aes_gcm.py::TestAESModeGCM::test_gcm_tag_decrypt_finalize_tag_length[tagtooshort]", "tests/hazmat/primitives/test_ciphers.py::TestCamellia::test_key_size[00000000000000000000000000000000-128]", "tests/hazmat/primitives/test_ciphers.py::TestAESXTS::test_invalid_key_size_with_mode[CB...
[ "tests/hazmat/primitives/test_aes_gcm.py::TestAESModeGCM::test_gcm_tag_decrypt_finalize_tag_length[toolongtoolongtoolongtoolongtoolongtoolongtoolongtoolongtoolongtoolongtoolongtoolong]", "tests/hazmat/primitives/test_ciphers.py::test_invalid_gcm_algorithm" ]
Python
[]
[]
pyca/cryptography
6,268
pyca__cryptography-6268
[ "6267" ]
7bb03065237d9a16477e2d94734638aa8f8ba692
diff --git a/src/cryptography/utils.py b/src/cryptography/utils.py --- a/src/cryptography/utils.py +++ b/src/cryptography/utils.py @@ -7,6 +7,7 @@ import enum import inspect import sys +import types import typing import warnings @@ -113,8 +114,9 @@ def __init__(self, value, message, warning_class): self...
diff --git a/tests/test_utils.py b/tests/test_utils.py --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -4,6 +4,7 @@ import binascii +import inspect import os import textwrap @@ -12,6 +13,7 @@ import pytest import cryptography +import cryptography.utils from cryptography.exceptions import Unsupporte...
_ModuleWithDeprecations should inherit from types.ModuleType Steps for reproducing bug: ```python import inspect import cryptography.utils inspect.getsourcefile(cryptography.utils) ``` This will produce the following error: > TypeError: module, class, method, function, traceback, frame, or code object was expect...
2021-09-10T12:03:40Z
35.0
[ "tests/test_utils.py::test_load_ed25519_vectors", "tests/test_utils.py::test_load_cryptrec_vectors_invalid", "tests/test_utils.py::test_load_nist_vectors", "tests/test_utils.py::test_check_backend_support_skip", "tests/test_utils.py::test_load_nist_vectors_with_null_chars", "tests/test_utils.py::test_chec...
[ "tests/test_utils.py::test_inspect_deprecated_module" ]
Python
[]
[]
pyca/cryptography
6,562
pyca__cryptography-6562
[ "6072" ]
924926de424841ed35abe8116f47016ccd9f70c2
diff --git a/src/cryptography/hazmat/primitives/asymmetric/types.py b/src/cryptography/hazmat/primitives/asymmetric/types.py --- a/src/cryptography/hazmat/primitives/asymmetric/types.py +++ b/src/cryptography/hazmat/primitives/asymmetric/types.py @@ -10,6 +10,8 @@ ed25519, ed448, rsa, + x25519, + x...
diff --git a/tests/x509/test_x509.py b/tests/x509/test_x509.py --- a/tests/x509/test_x509.py +++ b/tests/x509/test_x509.py @@ -27,6 +27,8 @@ ed448, padding, rsa, + x25519, + x448, ) from cryptography.hazmat.primitives.asymmetric.utils import ( decode_dss_signature, @@ -2968,6 +2970,56 @@ def...
X25519 certificates I'd like to equip entities with X25519 keys and certificates, so they can verify each others' identity as being inside my PKI hierarchy (Noise for IoT, kinda). It turns out to be possible to do this with openssl using `-force_pubkey` (yes, lovely ^^): ``` # generate CSR with an auxiliary key, e...
FWIW, simply allowing X25519PublicKey (and X448PublicKey) in `cryptography.x509.CertificateBuilder.public_key` does the trick for me. Is there official standard/RFC for X25519 in X.509? RFC 8410 This is both easier and harder now. Easier in that we now independently do signing and generate all the ASN.1 ourselves in ru...
2021-11-07T21:59:30Z
36.0
[ "tests/x509/test_x509.py::TestRSACertificate::test_generalized_time_not_before_cert", "tests/x509/test_x509.py::TestRSACertificate::test_load_legacy_pem_header", "tests/x509/test_x509.py::TestCertificateRevocationList::test_tbs_certlist_bytes", "tests/x509/test_x509.py::TestCertificateRevocationList::test_loa...
[ "tests/x509/test_x509.py::TestCertificateBuilder::test_build_cert_with_public_x25519_x448_rsa_sig[X25519PrivateKey-X25519PublicKey]", "tests/x509/test_x509.py::TestCertificateBuilder::test_build_cert_with_public_x25519_x448_rsa_sig[X448PrivateKey-X448PublicKey]" ]
Python
[]
[]
pyca/cryptography
7,160
pyca__cryptography-7160
[ "7127" ]
4d5a2c6e1dda8df9cae258de4a2a2f3bacec75aa
diff --git a/src/cryptography/x509/name.py b/src/cryptography/x509/name.py --- a/src/cryptography/x509/name.py +++ b/src/cryptography/x509/name.py @@ -42,6 +42,7 @@ class _ASN1Type(utils.Enum): # Type alias _OidNameMap = typing.Mapping[ObjectIdentifier, str] +_NameOidMap = typing.Mapping[str, ObjectIdentifier] #...
diff --git a/tests/x509/test_name.py b/tests/x509/test_name.py --- a/tests/x509/test_name.py +++ b/tests/x509/test_name.py @@ -164,3 +164,21 @@ def test_valid(self, subtests): with subtests.test(): result = Name.from_rfc4514_string(value) assert result == expected + + d...
RFC4514 parser doesn't accept OID overrides With v37.0 came RFC4514 string parsing support, which is great 🎉 But it seems it's lacking support for adding extra OIDs. For example, subjects wit an email address in them. ```python >>> from cryptography import x509 >>> from cryptography.x509 import NameOID >>> ...
2022-04-30T20:17:08Z
38.0
[ "tests/x509/test_name.py::TestRFC4514::test_invalid", "tests/x509/test_name.py::TestRFC4514::test_valid" ]
[ "tests/x509/test_name.py::TestRFC4514::test_attr_name_override" ]
Python
[]
[]
pyca/cryptography
7,162
pyca__cryptography-7162
[ "4858" ]
895a07abf230c0c99043ac2cb5e90c017ab2e1c5
diff --git a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py --- a/src/cryptography/hazmat/backends/openssl/backend.py +++ b/src/cryptography/hazmat/backends/openssl/backend.py @@ -706,6 +706,19 @@ def _evp_pkey_to_public_key(self, evp_pkey) -> PUBLIC_KEY_TYPES:...
diff --git a/tests/hazmat/primitives/test_rsa.py b/tests/hazmat/primitives/test_rsa.py --- a/tests/hazmat/primitives/test_rsa.py +++ b/tests/hazmat/primitives/test_rsa.py @@ -296,6 +296,30 @@ def test_load_pss_keys_strips_constraints(self, path, backend): signature, b"whatever", padding.PKCS1v15(), hashes....
x509._Certificate.public_key does not work with RSASSA_PSS certs Cause: in `cryptography/hazmat/backends/openssl/backend.py` `_evp_pkey_to_public_key` cryptography is only testing for `self._lib.EVP_PKEY_RSA` and not `EVP_PKEY_RSA_PSS` as well. I guess the same problem will occur with RSA OAEP certificates. * ...
This is related to #2850, but I'm going to leave this open so we can separate the parsing/signing components here. This also affects `load_der_public_key`: the PSS NID (912) doesn't seem to have a useful counterpart to `EVP_PKEY_get1_RSA()` used in parsing component. Looking into this it appears there may be several mi...
2022-04-30T21:11:44Z
38.0
[ "tests/hazmat/primitives/test_rsa.py::test_check_rsa_private_numbers_if_serializable", "tests/hazmat/primitives/test_rsa.py::test_skip_pss_hash_algorithm_unsupported", "tests/hazmat/primitives/test_rsa.py::test_modular_inverse", "tests/hazmat/primitives/test_rsa.py::TestRSAEncryption::test_rsa_encrypt_oaep[ke...
[ "tests/hazmat/primitives/test_rsa.py::TestRSA::test_load_pss_pub_keys_strips_constraints", "tests/x509/test_x509.py::TestRSAPSSCertificate::test_load_cert_pub_key" ]
Python
[]
[]
pyca/cryptography
7,292
pyca__cryptography-7292
[ "7246" ]
65f0812d7f54d568c675968be49ad63ed78ec004
diff --git a/src/cryptography/hazmat/backends/openssl/rsa.py b/src/cryptography/hazmat/backends/openssl/rsa.py --- a/src/cryptography/hazmat/backends/openssl/rsa.py +++ b/src/cryptography/hazmat/backends/openssl/rsa.py @@ -2,7 +2,7 @@ # 2.0, and the BSD License. See the LICENSE file in the root of this repository # f...
diff --git a/tests/hazmat/primitives/test_rsa.py b/tests/hazmat/primitives/test_rsa.py --- a/tests/hazmat/primitives/test_rsa.py +++ b/tests/hazmat/primitives/test_rsa.py @@ -447,6 +447,32 @@ def test_oaep_wrong_label(self, enclabel, declabel, backend): ), ) + def test_lazy_blinding(s...
RSA private key loading spends a lot of time enabling blinding (RSA_blinding_on) I have a use case where I need to parse a large number of RSA private keys, thus importing performance matters. I noticed that I can "abuse" the internal _rsa_skip_check_key symbol in newer versions and skip the RSA consistency checks, ...
For your specific situation you could monkeypatch the cffi lib object to make the blinding func a no op lambda. Blinding setup has significant cost (https://github.com/openssl/openssl/blob/38fc02a7084438e384e152effa84d4bf085783c9/crypto/bn/bn_blind.c#L233) so that’s why it’s slow. We could potentially do blinding...
2022-05-31T08:26:51Z
38.0
[ "tests/hazmat/primitives/test_rsa.py::test_check_rsa_private_numbers_if_serializable", "tests/hazmat/primitives/test_rsa.py::TestRSA::test_load_pss_vect_example_keys[pkcs1_example5]", "tests/hazmat/primitives/test_rsa.py::test_skip_pss_hash_algorithm_unsupported", "tests/hazmat/primitives/test_rsa.py::TestRSA...
[ "tests/hazmat/primitives/test_rsa.py::TestRSA::test_lazy_blinding" ]
Python
[]
[]
pyca/cryptography
7,520
pyca__cryptography-7520
[ "7441" ]
ceaf549de1c447d99277ceb8b8d086b79b41e794
diff --git a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py --- a/src/cryptography/hazmat/backends/openssl/backend.py +++ b/src/cryptography/hazmat/backends/openssl/backend.py @@ -1528,6 +1528,15 @@ def _private_key_bytes( "Passwords longer...
diff --git a/tests/hazmat/primitives/test_serialization.py b/tests/hazmat/primitives/test_serialization.py --- a/tests/hazmat/primitives/test_serialization.py +++ b/tests/hazmat/primitives/test_serialization.py @@ -2335,9 +2335,10 @@ def test_serialize_ssh_private_key_errors(self, backend): # bad object type...
[WIP] feat: add kdf_rounds param to encryption algorithm ### Summary Currently the number of `kdf_rounds` used when encrypting OpenSSH private keys is fixed at the `ssh-keygen` default of `16`. `ssh-keygen` however parameterizes this value with the `-a` flag. This PR permits the same parameterization through the `Be...
Thank you for working on this! As you've discovered, our API doesn't have a clear place to override any options about how encryption is performed. Unfortunately, simply adding `kdf_rounds` to `BestAvailableEncryption` is probably not correct. We'll need to design an API that considers that KDF rounds may not be meaning...
2022-08-16T22:34:40Z
38.0
[ "tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_load_der_dsa_public_key[asymmetric/DER_Serialization/dsa_public_key.der]", "tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_load_ec_public_key", "tests/hazmat/primitives/test_serialization.py::TestDERSerializati...
[ "tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_serialize_ssh_private_key_errors", "tests/hazmat/primitives/test_serialization.py::TestEncryptionBuilder::test_unsupported_format", "tests/hazmat/primitives/test_serialization.py::TestEncryptionBuilder::test_invalid_password", "tes...
Python
[]
[]
python/mypy
10,712
python__mypy-10712
[ "9744" ]
68b3b27c2fc47cc01f16d98e7e7d944ad5c0c6be
diff --git a/mypy/fastparse.py b/mypy/fastparse.py --- a/mypy/fastparse.py +++ b/mypy/fastparse.py @@ -44,7 +44,7 @@ from mypy import message_registry, errorcodes as codes from mypy.errors import Errors from mypy.options import Options -from mypy.reachability import mark_block_unreachable +from mypy.reachability imp...
diff --git a/test-data/unit/check-overloading.test b/test-data/unit/check-overloading.test --- a/test-data/unit/check-overloading.test +++ b/test-data/unit/check-overloading.test @@ -5421,3 +5421,884 @@ def f_f(arg: str) -> None: ... @Bad2() # E: "Bad2" not callable def f_f(arg): ... [builtins fixtures/dict.pyi] + ...
@overload cannot be used with conditional "if TYPE_CHECKING" **Bug Report** The handling of `@overload` decorators happens in (code) blocks only, which makes it not find the implementation when using: ```python from typing import overload from typing import TYPE_CHECKING from typing import Union class K: ...
I'm curious, why would you like an `if TYPE_CHECKING` block shielding overloads? They are ignored by the runtime anyways. > I'm curious, why would you like an `if TYPE_CHECKING` block shielding overloads? They are ignored by the runtime anyways. While it's just a dummy decorator I'd like to keep typing separate from...
2021-06-25T10:55:25Z
0.940
[ "mypy/test/testcheck.py::TypeCheckSuite::check-overloading.test::testSingleOverloadNoImplementation", "mypy/test/testcheck.py::TypeCheckSuite::check-overloading.test::testOverloadNotImportedNoCrash", "mypy/test/testcheck.py::TypeCheckSuite::check-overloading.test::testOverloadNeedsImplementation", "mypy/test/...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-overloading.test::testOverloadIfMerging", "mypy/test/testcheck.py::TypeCheckSuite::check-overloading.test::testOverloadIfBasic", "mypy/test/testcheck.py::TypeCheckSuite::check-overloading.test::testOverloadIfSysVersion", "mypy/test/testcheck.py::TypeCheckSuite::c...
Python
[]
[]
python/mypy
10,969
python__mypy-10969
[ "10330" ]
0fecec8c72605ec7bae343b28d545c477c726e81
diff --git a/mypy/nodes.py b/mypy/nodes.py --- a/mypy/nodes.py +++ b/mypy/nodes.py @@ -106,7 +106,8 @@ def get_column(self) -> int: '__doc__': None, # depends on Python version, see semanal.py '__path__': None, # depends on if the module is a package '__file__': '__builtins__.str', - '__package__': ...
diff --git a/test-data/unit/check-basic.test b/test-data/unit/check-basic.test --- a/test-data/unit/check-basic.test +++ b/test-data/unit/check-basic.test @@ -236,32 +236,16 @@ from typing import Any def f() -> Any: yield -[case testModule__name__] +[case testModuleImplicitAttributes] import typing -x = __name__...
Module-level `__annotations__` variable is flagged as undefined To repro, run mypy on the following: ```python print(__annotations__) ``` ``` test.py:1: error: Name '__annotations__' is not defined Found 1 error in 1 file (checked 1 source file) ``` A pyright user recently noted [the same issue in pyright...
Thanks, fixable along the lines of https://github.com/python/mypy/pull/9454 I can take a look at this. Seems like the previous PR was closed. I can give this a shot!
2021-08-11T15:25:53Z
0.950
[ "mypy/test/testcheck.py::TypeCheckSuite::check-basic.test::testEmptyFile", "mypy/test/testcheck.py::TypeCheckSuite::check-basic.test::testVarDefWithInit", "mypy/test/testcheck.py::TypeCheckSuite::check-basic.test::testImplicitInheritInitFromObject", "mypy/test/testcheck.py::TypeCheckSuite::check-basic.test::t...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-basic.test::testModuleImplicitAttributes" ]
Python
[]
[]
python/mypy
11,203
python__mypy-11203
[ "5876" ]
52f1dd309c80d456027351fd6c0905e53dcde11a
diff --git a/mypy/subtypes.py b/mypy/subtypes.py --- a/mypy/subtypes.py +++ b/mypy/subtypes.py @@ -12,6 +12,8 @@ # Circular import; done in the function instead. # import mypy.solve from mypy.nodes import ( + ARG_STAR, + ARG_STAR2, CONTRAVARIANT, COVARIANT, Decorator, @@ -1291,6 +1293,16 @@ def ...
diff --git a/test-data/unit/check-classes.test b/test-data/unit/check-classes.test --- a/test-data/unit/check-classes.test +++ b/test-data/unit/check-classes.test @@ -7136,6 +7136,16 @@ class B(A): # E: Final class __main__.B has abstract attributes "foo" class C: class C1(XX): pass # E: Name "XX" is not define...
Make any callable compatible with (*args: Any, **kwargs: Any)? Perhaps a callable that accepts arbitrary arguments by having `(*args: Any, **kwargs: Any)` could be treated similarly to `Callable[..., X]` (with explicit `...`), i.e. a callable with arbitrary arguments would be compatible with it. The reason for this ...
I actually like this idea, I have seen this confusion several times, and although it is a bit unsafe, most of the time when people write `(*args, **kwargs)` it means "don't care", rather than "should work for all calls". Agreed, this is a case where practicality beats purity. I just stumbled upon this trying to build ...
2021-09-27T02:39:21Z
0.980
[ "mypy/test/testcheck.py::TypeCheckSuite::check-classes.test::testDecoratedInitSubclassWithAnyReturnValueType", "mypy/test/testcheck.py::TypeCheckSuite::check-classes.test::testMethodCall", "mypy/test/testcheck.py::TypeCheckSuite::check-classes.test::testReverseOperatorTypeVar2b", "mypy/test/testcheck.py::Type...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-functions.test::testSubtypingFunctionsArgsKwargs", "mypy/test/testcheck.py::TypeCheckSuite::check-classes.test::testArgsKwargsInheritance", "mypy/test/testcheck.py::TypeCheckSuite::check-functions.test::testCallableTypeAnalysis" ]
Python
[]
[]
python/mypy
11,499
python__mypy-11499
[ "3825" ]
67855fab376c3c2d68bcf0940b242c9b71a98156
diff --git a/mypy/semanal.py b/mypy/semanal.py --- a/mypy/semanal.py +++ b/mypy/semanal.py @@ -1683,6 +1683,8 @@ class Foo(Bar, Generic[T]): ... declared_tvars: TypeVarLikeList = [] is_protocol = False for i, base_expr in enumerate(base_type_exprs): + if isinstance(base_expr, StarE...
diff --git a/test-data/unit/check-tuples.test b/test-data/unit/check-tuples.test --- a/test-data/unit/check-tuples.test +++ b/test-data/unit/check-tuples.test @@ -972,6 +972,17 @@ b = (1, 'x') a = (0, *b, '') [builtins fixtures/tuple.pyi] +[case testUnpackSyntaxError] +*foo # E: Can use starred expression only as ...
Tuple assignment and list * unpacking crashes mypy Ran mypy over the following code: ``` a = [1, 2, 3] first, *other = [*a, None] ``` Interestingly enough, `first, *other = [None, *a]` works correctly. Happy to give it a shot at fixing this myself is someone can give me some pointers on where to start. Except...
Based on `first, *other = [None, *a]` working correctly I'm guessing with `first, *other = [*a, None]` we are trying to unpack `*a` into `first`, and `None` into `*other`, which is wrong. (Bumping priority to high since this appeared again in the context of mypyc) I think the cop-out way to fix this would be to have `c...
2021-11-08T20:22:43Z
1.0
[ "mypy/test/testcheck.py::TypeCheckSuite::check-tuples.test::testMultipleAssignmentWithNonTupleRvalue", "mypy/test/testcheck.py::TypeCheckSuite::check-tuples.test::testTupleInitializationWithNone", "mypy/test/testcheck.py::TypeCheckSuite::check-tuples.test::testMultipleAssignmentWithTuples", "mypy/test/testche...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-tuples.test::testUnpackBases", "mypy/test/testcheck.py::TypeCheckSuite::check-tuples.test::testUnpackSyntaxError" ]
Python
[]
[]
python/mypy
11,717
python__mypy-11717
[ "11705" ]
e0a89b75fbefc48bb82c924979a8e1c52d65818e
diff --git a/mypy/checker.py b/mypy/checker.py --- a/mypy/checker.py +++ b/mypy/checker.py @@ -4550,17 +4550,16 @@ def has_no_custom_eq_checks(t: Type) -> bool: self._check_for_truthy_type(original_vartype, node) vartype = try_expanding_sum_type_to_union(original_vartype, "builtins.bool") - i...
diff --git a/test-data/unit/check-inference.test b/test-data/unit/check-inference.test --- a/test-data/unit/check-inference.test +++ b/test-data/unit/check-inference.test @@ -3210,3 +3210,33 @@ def test(seq: List[Union[Iterable, Any]]) -> None: k = [k] reveal_type(k) # N: Revealed type is "bu...
Type inference regression with "and" and strict optional disabled This generates a false positive: ```py # mypy: no-strict-optional from typing import Tuple, Dict, Optional, NamedTuple class C(NamedTuple): x: int t: Optional[C] d: Dict[C, bytes] x = t and d[t] if x: x.startswith(b'x') # Ite...
The problem is that `t and d[t]` is revealed as `Union[Tuple[builtins.int, fallback=ex.C], builtins.bytes*]`. But, it should be revealed as `Optional[bytes]` I will try to solve it. Let's test it: https://github.com/python/mypy/pull/11717
2021-12-11T21:39:40Z
0.940
[ "mypy/test/testcheck.py::TypeCheckSuite::check-inference.test::testInferringLvarTypeFromArgument", "mypy/test/testcheck.py::TypeCheckSuite::check-inference.test::testLvarInitializedToVoid", "mypy/test/testcheck.py::TypeCheckSuite::check-inference.test::testInferSimpleLvarType", "mypy/test/testcheck.py::TypeCh...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-inference.test::testRegression11705_NoStrict" ]
Python
[]
[]
python/mypy
11,810
python__mypy-11810
[ "11774" ]
6de254ef00f99ce5284ab947f2dd1179db6d28f6
diff --git a/mypy/checkexpr.py b/mypy/checkexpr.py --- a/mypy/checkexpr.py +++ b/mypy/checkexpr.py @@ -1,6 +1,5 @@ """Expression type checker. This file is conceptually part of TypeChecker.""" -from mypy.util import unnamed_function from mypy.backports import OrderedDict, nullcontext from contextlib import context...
diff --git a/test-data/unit/check-functions.test b/test-data/unit/check-functions.test --- a/test-data/unit/check-functions.test +++ b/test-data/unit/check-functions.test @@ -2230,6 +2230,12 @@ reveal_type(h) # N: Revealed type is "builtins.function" h(7) # E: Cannot call function of unknown type [builtins fixtures/b...
0.920: Calling function named "_" is not allowed The following code: ```python3 #from gettext import translation #from typing import TYPE_CHECKING #if TYPE_CHECKING: def _(s: str) -> str: # stub for gettext string wrapper return s #translation('Test').install() print(_("test")) ``` produces the foll...
Note: the problem didn't occur until v0.920. I'm using an `_` function to attach metadata to attributes of classes (with metaclasses) and dataclasses for clarity and conciseness while providing proper type checking. While the function could be named `field()` or something else, it adds another name that the user must p...
2021-12-21T11:52:31Z
0.940
[ "mypy/test/testcheck.py::TypeCheckSuite::check-functions.test::testPositionalOverridingArgumentNamesCheckedWhenMismatchingPos", "mypy/test/testcheck.py::TypeCheckSuite::check-functions.test::testKeywordOnlyArgumentOrderInsensitivity", "mypy/test/testcheck.py::TypeCheckSuite::check-functions.test::testPositional...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-functions.test::testFunctionWithNameUnderscore" ]
Python
[]
[]
python/mypy
11,814
python__mypy-11814
[ "11808" ]
578898dabae9a6c91b8f1081630c91cbe7e6f5be
diff --git a/mypy/typeanal.py b/mypy/typeanal.py --- a/mypy/typeanal.py +++ b/mypy/typeanal.py @@ -1291,7 +1291,9 @@ def visit_unbound_type(self, t: UnboundType) -> TypeVarLikeList: return [] elif node and node.fullname in ('typing_extensions.Literal', 'typing.Literal'): return [] - ...
diff --git a/test-data/unit/semanal-errors.test b/test-data/unit/semanal-errors.test --- a/test-data/unit/semanal-errors.test +++ b/test-data/unit/semanal-errors.test @@ -1435,3 +1435,10 @@ TP = ParamSpec('?') # E: String argument 1 "?" to ParamSpec(...) does not match TP2: int = ParamSpec('TP2') # E: Cannot declare...
crash when extending `typing_extensions.Annotated` ```py from typing_extensions import Annotated class A(Annotated): pass ``` ``` Sandpit\Test.py:172: error: INTERNAL ERROR -- Please try using mypy master on Github: https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build ana...
Fix is on its way! Thanks for the report! 👍
2021-12-21T22:24:44Z
0.940
[ "mypy/test/testsemanal.py::SemAnalErrorSuite::semanal-errors.test::testUndefinedVariableInGlobalStatement", "mypy/test/testsemanal.py::SemAnalErrorSuite::semanal-errors.test::testUndefinedVariableWithinFunctionContext", "mypy/test/testsemanal.py::SemAnalErrorSuite::semanal-errors.test::testMethodScope", "mypy...
[ "mypy/test/testsemanal.py::SemAnalErrorSuite::semanal-errors.test::testBaseClassAnnotatedWithoutArgs" ]
Python
[]
[]
python/mypy
11,822
python__mypy-11822
[ "11819" ]
f96446ce2f99a86210b21d39c7aec4b13a8bfc66
diff --git a/mypy/types.py b/mypy/types.py --- a/mypy/types.py +++ b/mypy/types.py @@ -1500,12 +1500,31 @@ class TupleType(ProperType): def __init__(self, items: List[Type], fallback: Instance, line: int = -1, column: int = -1, implicit: bool = False) -> None: - super().__init__(line, co...
diff --git a/test-data/unit/check-namedtuple.test b/test-data/unit/check-namedtuple.test --- a/test-data/unit/check-namedtuple.test +++ b/test-data/unit/check-namedtuple.test @@ -1081,3 +1081,42 @@ t: T y: List[T] = [t] [builtins fixtures/tuple.pyi] [typing fixtures/typing-namedtuple.pyi] + +[case testNamedTupleWith...
Overriding __bool__ in NamedTuple doesn't work Even if `__bool__` is overridden in a subclass of `NamedTuple`, mypy thinks instances of this subclass can't evaluate to `False`. This possibility was mentioned in https://github.com/python/mypy/issues/3601#issuecomment-311372136 before, but it appears this wasn't fixed...
2021-12-22T20:15:44Z
0.940
[ "mypy/test/testcheck.py::TypeCheckSuite::check-namedtuple.test::testNamedTupleNoUnderscoreFields", "mypy/test/testcheck.py::TypeCheckSuite::check-namedtuple.test::testNamedTupleUsedAsTuple", "mypy/test/testcheck.py::TypeCheckSuite::check-namedtuple.test::testNamedTupleUnicode_python2", "mypy/test/testcheck.py...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-namedtuple.test::testNamedTupleWithBoolNarrowsToBool" ]
Python
[]
[]
python/mypy
11,824
python__mypy-11824
[ "11821" ]
f96446ce2f99a86210b21d39c7aec4b13a8bfc66
diff --git a/mypy/plugins/dataclasses.py b/mypy/plugins/dataclasses.py --- a/mypy/plugins/dataclasses.py +++ b/mypy/plugins/dataclasses.py @@ -221,9 +221,12 @@ def add_slots(self, self._ctx.reason, ) return - if info.slots is not None or info.names.get('__slots__'): + +...
diff --git a/test-data/unit/check-dataclasses.test b/test-data/unit/check-dataclasses.test --- a/test-data/unit/check-dataclasses.test +++ b/test-data/unit/check-dataclasses.test @@ -1456,3 +1456,69 @@ class Other: __slots__ = ('x',) x: int [builtins fixtures/dataclasses.pyi] + + +[case testSlotsDefinitionWi...
Regression in 0.930 - Slots **Bug Report** This error is incorrectly showing up on my class that inherits from Generic[V]. This is probably because it inherits from Protocol, which defines `__slots__ = ()` error: "Node" both defines "__slots__" and is used with "slots=True" [misc] **To Reproduce** ``` C ...
This happens because `semanal` requires two passes and we already set `__slots__` during the first pass. Fix is incomming.
2021-12-22T20:41:24Z
0.940
[ "mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesCustomInit", "mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesBasic", "mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesBasicInheritance", "mypy/test/testcheck.py::TypeC...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testSlotsDefinitionWithTwoPasses1", "mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testSlotsDefinitionWithTwoPasses4" ]
Python
[]
[]
python/mypy
11,828
python__mypy-11828
[ "11825" ]
f96446ce2f99a86210b21d39c7aec4b13a8bfc66
diff --git a/mypy/config_parser.py b/mypy/config_parser.py --- a/mypy/config_parser.py +++ b/mypy/config_parser.py @@ -57,6 +57,12 @@ def expand_path(path: str) -> str: return os.path.expandvars(os.path.expanduser(path)) +def str_or_array_as_list(v: Union[str, Sequence[str]]) -> List[str]: + if isinstance(v...
diff --git a/test-data/unit/cmdline.pyproject.test b/test-data/unit/cmdline.pyproject.test --- a/test-data/unit/cmdline.pyproject.test +++ b/test-data/unit/cmdline.pyproject.test @@ -80,3 +80,48 @@ def g(a: int) -> int: [out] pyproject.toml: toml config file contains [[tool.mypy.overrides]] sections with conflicting ...
Crash/Regression - 0.930 no longer accepts multiline basic strings for `exclude` patterns in `pyproject.toml` **Crash Report** ``` toml # pyproject.toml [tool.mypy] exclude = """(?x)( (^|/)build/ )""" ``` Anyone using a [multiline basic string](https://toml.io/en/v1.0.0#string) to define a regex for `excl...
I'm pretty sure [this](https://github.com/python/mypy/pull/11329/files#r774194968) is the root cause. This works: ``` toml # pyproject.toml [tool.mypy] exclude = """ (^|/)build/ """ ``` That's weird, though. I would have expected that expressing multiple `exclude` entries in `pyproject.toml` would look...
2021-12-22T23:22:22Z
0.940
[ "mypy/test/testcmdline.py::PythonCmdlineSuite::cmdline.pyproject.test::testConflictingModuleInOverridesPyprojectTOML", "mypy/test/testcmdline.py::PythonCmdlineSuite::cmdline.pyproject.test::testNonArrayOverridesPyprojectTOML", "mypy/test/testcmdline.py::PythonCmdlineSuite::cmdline.pyproject.test::testNoModuleIn...
[ "mypy/test/testcmdline.py::PythonCmdlineSuite::cmdline.pyproject.test::testMultilineLiteralExcludePyprojectTOML", "mypy/test/testcmdline.py::PythonCmdlineSuite::cmdline.pyproject.test::testMultilineBasicExcludePyprojectTOML", "mypy/test/testcmdline.py::PythonCmdlineSuite::cmdline.pyproject.test::testSequenceExc...
Python
[]
[]
python/mypy
11,867
python__mypy-11867
[ "11856" ]
3d205764fff2ca792886d84d0a16791dfd33f077
diff --git a/mypy/semanal.py b/mypy/semanal.py --- a/mypy/semanal.py +++ b/mypy/semanal.py @@ -2037,12 +2037,10 @@ def visit_import_all(self, i: ImportAll) -> None: if self.process_import_over_existing_name( name, existing_symbol, node, i): ...
diff --git a/test-data/unit/check-flags.test b/test-data/unit/check-flags.test --- a/test-data/unit/check-flags.test +++ b/test-data/unit/check-flags.test @@ -1562,17 +1562,7 @@ __all__ = ('b',) [out] main:2: error: Module "other_module_2" does not explicitly export attribute "a"; implicit reexport disabled -[case ...
Consider `from .sub import *` as re-exporting all the public symbols of `sub` **Bug Report** This goes directly against what was made in #7361 but it's more consistent with [PEP 484](https://www.python.org/dev/peps/pep-0484/) which says: > - Modules and variables imported into the stub are not considered exported...
Linking https://github.com/python/mypy/issues/8754 which is not the same but also has issues related to re-exports and is another discrepancy between mypy and Pyright. Thanks for flagging this, I'd be in favour of changing mypy's behaviour here. Should be backward compatible in that we're allowing strictly more code. ...
2021-12-29T18:04:40Z
0.940
[ "mypy/test/testcheck.py::TypeCheckSuite::check-flags.test::testNoArgumentFunction", "mypy/test/testcheck.py::TypeCheckSuite::check-flags.test::testUnannotatedFunction", "mypy/test/testcheck.py::TypeCheckSuite::check-flags.test::testUnannotatedArgument", "mypy/test/testcheck.py::TypeCheckSuite::check-flags.tes...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-flags.test::testNoImplicitReexportStarConsideredExplicit" ]
Python
[]
[]
python/mypy
11,870
python__mypy-11870
[ "11852" ]
fe3b625224d0246c90c2a2bca6f293a4586642e9
diff --git a/mypy/plugins/default.py b/mypy/plugins/default.py --- a/mypy/plugins/default.py +++ b/mypy/plugins/default.py @@ -15,7 +15,6 @@ from mypy.subtypes import is_subtype from mypy.typeops import make_simplified_union from mypy.checkexpr import is_literal_type_like -from mypy.checker import detach_callable ...
diff --git a/test-data/unit/check-default-plugin.test b/test-data/unit/check-default-plugin.test --- a/test-data/unit/check-default-plugin.test +++ b/test-data/unit/check-default-plugin.test @@ -24,56 +24,15 @@ f = g # E: Incompatible types in assignment (expression has type "Callable[[Any, [typing fixtures/typing-med...
mypy 0.930: regression: no longer keeping contextmanager generic return value **Bug Report** I bisected this, the regression was introduced in https://github.com/python/mypy/pull/11352 CC @BarnabyShearer @sobolevn here's a minimal case split out from `pre-commit`: ```python import concurrent.futures impor...
Thanks, I will have a look! 👍 @sobolevn I think it was a misunderstanding about send type in that PR -- there's no meaning of send types for `@contextmanager` since it only uses the yield type -- removing `detach_callable` fixes my snippet above let me know if you want me to turn this into a patch: ```diff dif...
2021-12-29T20:42:26Z
0.940
[ "mypy/test/testcheck.py::TypeCheckSuite::check-default-plugin.test::testContextManagerWithUnspecifiedArguments", "mypy/test/testcheck.py::TypeCheckSuite::check-default-plugin.test::testContextManagerWithGenericFunction", "mypy/test/testcheck.py::TypeCheckSuite::check-default-plugin.test::testAsyncContextManager...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-default-plugin.test::testContextManagerReturnsGenericFunction" ]
Python
[]
[]
python/mypy
11,881
python__mypy-11881
[ "11830" ]
229913e8e31ee2889ad3e2a3f85ffe82b29fa198
diff --git a/mypy/config_parser.py b/mypy/config_parser.py --- a/mypy/config_parser.py +++ b/mypy/config_parser.py @@ -126,7 +126,7 @@ def check_follow_imports(choice: str) -> str: 'cache_dir': expand_path, 'python_executable': expand_path, 'strict': bool, - 'exclude': lambda s: [p.strip() for p in s....
diff --git a/test-data/unit/cmdline.test b/test-data/unit/cmdline.test --- a/test-data/unit/cmdline.test +++ b/test-data/unit/cmdline.test @@ -1354,9 +1354,10 @@ b/bpkg.py:1: error: "int" not callable # cmd: mypy . [file mypy.ini] \[mypy] -exclude = - abc - b +exclude = (?x)( + ^abc/ + |^b/ + ) [file a...
handling of `exclude` configuration changed in an incompatible way in 0.930 https://github.com/python/mypy/issues/11825 seems related but slightly different as that one causes a crash -- I believe this was broken in https://github.com/python/mypy/pull/11329 **Bug Report** for example: (this is reduced from a larg...
cc @nipunn1313 something like #11828 should work for pyproject.toml, but curious for your opinion on what this should look like going forward for ini files Great question. I think the safest option is to maintain the old behavior on `.ini` files - such that you cannot provide multiple `--exclude` inside `ini` files....
2022-01-01T01:49:19Z
0.940
[ "mypy/test/testcmdline.py::PythonCmdlineSuite::cmdline.test::testCmdlineNonPackageDuplicate", "mypy/test/testcmdline.py::PythonCmdlineSuite::cmdline.test::testCmdlineInvalidPackageName", "mypy/test/testcmdline.py::PythonCmdlineSuite::cmdline.test::testConfigFile", "mypy/test/testcmdline.py::PythonCmdlineSuite...
[ "mypy/test/testcmdline.py::PythonCmdlineSuite::cmdline.test::testCmdlineCfgMultipleExclude" ]
Python
[]
[]
python/mypy
11,912
python__mypy-11912
[ "11903" ]
27d2c2212547f137ade8b2098902a8c80ca82f78
diff --git a/mypy/semanal.py b/mypy/semanal.py --- a/mypy/semanal.py +++ b/mypy/semanal.py @@ -2247,6 +2247,12 @@ def is_type_ref(self, rv: Expression, bare: bool = False) -> bool: return True # Assignment color = Color['RED'] defines a variable, not an alias. return not rv.no...
diff --git a/test-data/unit/check-type-aliases.test b/test-data/unit/check-type-aliases.test --- a/test-data/unit/check-type-aliases.test +++ b/test-data/unit/check-type-aliases.test @@ -50,6 +50,14 @@ def f(x: A) -> None: f(1) f('x') +[case testNoReturnTypeAlias] +# https://github.com/python/mypy/issues/11903 +fro...
regression: type alias for `NoReturn` no longer works as a type annotation this worked in 0.921 ```py from typing import NoReturn Never = NoReturn a: Never # error: Variable "__main__.Never" is not valid as a type [valid-type] b: NoReturn # no error ``` https://mypy-play.net/?mypy=0.930&python=3.10&flags=...
Thanks for the report. I think this is a side effect of https://github.com/python/typeshed/pull/6290 Not seriously suggesting this, but a fun workaround happens to be `from mypy_extensions import NoReturn`, since I did a slightly different thing in https://github.com/python/typeshed/pull/6595 Btw, if you have a rep...
2022-01-05T19:00:53Z
0.940
[ "mypy/test/testcheck.py::TypeCheckSuite::check-type-aliases.test::testSimpleTypeAlias", "mypy/test/testcheck.py::TypeCheckSuite::check-type-aliases.test::testCallableTypeAlias", "mypy/test/testcheck.py::TypeCheckSuite::check-type-aliases.test::testTupleTypeAlias", "mypy/test/testcheck.py::TypeCheckSuite::chec...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-type-aliases.test::testNoReturnTypeAlias" ]
Python
[]
[ "https://mypy-play.net/?mypy=0.930&python=3.10&flags=show-error-codes%2Callow-redefinition%2Cstrict%2Ccheck-untyped-defs%2Cdisallow-any-decorated%2Cdisallow-any-expr%2Cdisallow-any-explicit%2Cdisallow-any-generics%2Cdisallow-any-unimported%2Cdisallow-incomplete-defs%2Cdisallow-subclassing-any%2Cdisallow-untyped-cal...
python/mypy
11,918
python__mypy-11918
[ "11859" ]
37886c74fe8b0a40e6427361f3dcb3a9d0d82751
diff --git a/mypy/semanal.py b/mypy/semanal.py --- a/mypy/semanal.py +++ b/mypy/semanal.py @@ -4085,6 +4085,7 @@ def analyze_type_application(self, expr: IndexExpr) -> None: name = target.type.fullname if (alias.no_args and # this avoids bogus errors for already reported aliases ...
diff --git a/test-data/unit/check-generic-alias.test b/test-data/unit/check-generic-alias.test --- a/test-data/unit/check-generic-alias.test +++ b/test-data/unit/check-generic-alias.test @@ -285,3 +285,14 @@ class C(list[int]): pass d: type[str] [builtins fixtures/list.pyi] + + +[case testTypeAliasWithBuiltinLis...
'"dict" is not subscriptable' error when using a type alias for `dict` in a `.pyi` stub file, with Python <= 3.8 **Bug Report** This error only occurs when mypy is run using Python <= 3.8. Here is a minimal reproducible example: ```python _DictReadMapping = dict class Foo(_DictReadMapping[str, int]): ... # e...
(Cc. @JukkaL, @sobolevn, since this is somewhat related to https://github.com/python/typeshed/issues/4820) Related to https://github.com/python/mypy/pull/11863 I can refactor `TypeAlias` logic after my initial PR is merged 👍
2022-01-06T08:16:37Z
0.940
[ "mypy/test/testcheck.py::TypeCheckSuite::check-generic-alias.test::testGenericBuiltinSetWarning", "mypy/test/testcheck.py::TypeCheckSuite::check-generic-alias.test::testGenericCollectionsWarning", "mypy/test/testcheck.py::TypeCheckSuite::check-generic-alias.test::testGenericBuiltinWarning", "mypy/test/testche...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-generic-alias.test::testTypeAliasWithBuiltinListAliasInStub" ]
Python
[]
[]
python/mypy
11,945
python__mypy-11945
[ "11820" ]
378119fb0ce7cb6133eeccd4de236a330cc8e10e
diff --git a/mypy/checker.py b/mypy/checker.py --- a/mypy/checker.py +++ b/mypy/checker.py @@ -2517,7 +2517,7 @@ def check_compatibility_final_super(self, node: Var, self.msg.cant_override_final(node.name, base.name, node) return False if node.is_final: - if base.fullname i...
diff --git a/test-data/unit/check-enum.test b/test-data/unit/check-enum.test --- a/test-data/unit/check-enum.test +++ b/test-data/unit/check-enum.test @@ -1712,9 +1712,17 @@ class B(A): pass # E: Cannot inherit from final class "A" [case testEnumFinalSpecialProps] # https://github.com/python/mypy/issues/11699 +# h...
Regression in mypy 0.930: Cannot override writable attribute "__module__" with a final one **Bug Report** The following code is reported as error by mypy 0.930 (Python 3.8). It seems correct, and was considered correct so far: ```python from enum import Enum class PyFormat(str, Enum): __module__ = "psyco...
Thanks! Fix is on its way. You can add `# type: ignore` for now. I'm afraid it will have to be "mypy != 0.930" because there are too many of them and because psycopg is also affected by https://github.com/python/typeshed/issues/6661 :smile: https://github.com/psycopg/psycopg/runs/4610348714?check_suite_focus=true I...
2022-01-09T13:00:28Z
0.940
[ "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumBasics", "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumFromEnumMetaBasics", "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumCreatedFromStringLiteral", "mypy/test/testcheck.py::TypeCheckSuite::check-enum.tes...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumFinalSpecialProps" ]
Python
[]
[]
python/mypy
11,962
python__mypy-11962
[ "11919", "11919" ]
9ea6d928646f823af0bb646cca0aba26be7e1107
diff --git a/mypy/semanal.py b/mypy/semanal.py --- a/mypy/semanal.py +++ b/mypy/semanal.py @@ -2107,10 +2107,10 @@ def visit_assignment_stmt(self, s: AssignmentStmt) -> None: s.is_final_def = self.unwrap_final(s) self.analyze_lvalues(s) self.check_final_implicit_def(s) + self.store_fin...
diff --git a/test-data/unit/check-enum.test b/test-data/unit/check-enum.test --- a/test-data/unit/check-enum.test +++ b/test-data/unit/check-enum.test @@ -618,8 +618,8 @@ reveal_type(A2.x.value) # N: Revealed type is "builtins.int" reveal_type(A2.x._value_) # N: Revealed type is "builtins.int" is_x(reve...
Make enum values final #10852 made it so that boolean values are correctly identified as Literals in an enum. Other values seem to not be: ```python a.py from enum import Enum class Truth(Enum): true = True false = False class MyInt(Enum): a = 0 b = 1 class MyStr(Enum): a = "a" ...
Some experimentation shows that commenting out `lvalue.is_inferred_def = False` inside of `store_declared_types` in `semanal.py` fixes this issue, although I'm sure it breaks a bunch of other things. I don't yet understand enough to know why this is called for all types except bool Some experimentation shows that comme...
2022-01-10T13:10:13Z
0.940
[ "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumBasics", "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumFromEnumMetaBasics", "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumCreatedFromFinalValue", "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumAttributeAccessMatrix", "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumAttributeChangeIncremental", "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumWithInstanceAttributes", "mypy/test/testcheck.py::TypeCheck...
Python
[]
[]
python/mypy
11,966
python__mypy-11966
[ "11921" ]
48d810d5ed25f898d4f220a7476b6b267c289b9a
diff --git a/mypy/plugins/dataclasses.py b/mypy/plugins/dataclasses.py --- a/mypy/plugins/dataclasses.py +++ b/mypy/plugins/dataclasses.py @@ -4,9 +4,10 @@ from typing_extensions import Final from mypy.nodes import ( - ARG_OPT, ARG_NAMED, ARG_NAMED_OPT, ARG_POS, MDEF, Argument, AssignmentStmt, CallExpr, - Con...
diff --git a/test-data/unit/check-dataclasses.test b/test-data/unit/check-dataclasses.test --- a/test-data/unit/check-dataclasses.test +++ b/test-data/unit/check-dataclasses.test @@ -1522,3 +1522,17 @@ PublishedMessagesVar = dict[int, 'PublishedMessages'] class PublishedMessages: left: int [builtins fixtures/dat...
Inheriting from Any with dataclass I'm importing a package at a path mypy doesn't know about and using the `--ignore-missing-imports` flag. ```python a.py import dataclasses from mypackage import MyClass # @dataclasses.dataclass # class MyClass: # bar: str @dataclasses.dataclass class Inherits(MyClass...
2022-01-10T18:02:34Z
0.940
[ "mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesCustomInit", "mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesBasic", "mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesBasicInheritance", "mypy/test/testcheck.py::TypeC...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesAnyInherit" ]
Python
[]
[]
python/mypy
11,972
python__mypy-11972
[ "11971" ]
6c1eb5b36b83ecf959a50100d282ca86186f470f
diff --git a/mypy/semanal.py b/mypy/semanal.py --- a/mypy/semanal.py +++ b/mypy/semanal.py @@ -2871,7 +2871,7 @@ def analyze_name_lvalue(self, outer = self.is_global_or_nonlocal(name) if kind == MDEF and isinstance(self.type, TypeInfo) and self.type.is_enum: # Special case: we need to be ...
diff --git a/test-data/unit/check-enum.test b/test-data/unit/check-enum.test --- a/test-data/unit/check-enum.test +++ b/test-data/unit/check-enum.test @@ -1810,4 +1810,4 @@ reveal_type(A.str.value) # N: Revealed type is "Literal['foo']?" reveal_type(A.int.value) # N: Revealed type is "Literal[1]?" reveal_type(A.boo...
False positives for "Attempted to reuse member name in Enum" <!-- If you're new to mypy and you're not sure whether what you're experiencing is a mypy bug, please see the "Question and Help" form instead. Please also consider: - checking our common issues page: https://mypy.readthedocs.io/en/stable/common...
2022-01-11T20:08:45Z
0.940
[ "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumBasics", "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumCreatedFromFinalValue", "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumCreatedFromStringLiteral", "mypy/test/testcheck.py::TypeCheckSuite::check-enum....
[ "mypy/test/testpythoneval.py::PythonEvaluationSuite::pythoneval.test::testEnumValueWithPlaceholderNodeType" ]
Python
[]
[]
python/mypy
11,984
python__mypy-11984
[ "11850" ]
9b3147701f054bf8ef42bd96e33153b05976a5e1
diff --git a/mypy/checker.py b/mypy/checker.py --- a/mypy/checker.py +++ b/mypy/checker.py @@ -24,9 +24,9 @@ Context, Decorator, PrintStmt, BreakStmt, PassStmt, ContinueStmt, ComparisonExpr, StarExpr, EllipsisExpr, RefExpr, PromoteExpr, Import, ImportFrom, ImportAll, ImportBase, TypeAlias, - ARG_POS, ...
diff --git a/test-data/unit/check-enum.test b/test-data/unit/check-enum.test --- a/test-data/unit/check-enum.test +++ b/test-data/unit/check-enum.test @@ -1469,22 +1469,22 @@ class NonEmptyFlag(Flag): class NonEmptyIntFlag(IntFlag): x = 1 -class ErrorEnumWithValue(NonEmptyEnum): # E: Cannot inherit from final ...
0.930 still gives me "inheriting final" error with an enum.Flag subclass **Bug Report** #11579 seems to fix #11578 in the 0.930 release, but still there are edge cases. **To Reproduce** Here is a minimal reproduction example. ```python import enum class StringSetFlag(enum.Flag): def __eq__(se...
This one is tricky: `__ror__ = __or__` Thank you! I will try to fix it tomorrow. For what it's worth, I've seen others run into this: https://github.com/hikari-py/hikari/commit/d1457038d9ac4bfad15e360631b9ac9895eacb7a#diff-f9118e96adf8379957f11aaba55186744ddfd128aa04bd0929c02ea55325c46cL66-R81 Ok, this one is quite co...
2022-01-13T12:02:41Z
0.940
[ "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumCreatedFromStringLiteral", "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumFromEnumMetaBasics", "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumCreatedFromFinalValue", "mypy/test/testcheck.py::TypeCheckSuite:...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumFinalSubtypingMethodAndValueSpecialCase", "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumNotFinalWithMethodsAndUninitializedValuesStub", "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumExplicitlyAndImplicitlyF...
Python
[]
[]
python/mypy
12,048
python__mypy-12048
[ "10189" ]
6d243321d632c47b9fef5f2ad6a972f9f4b94eff
diff --git a/mypy/semanal.py b/mypy/semanal.py --- a/mypy/semanal.py +++ b/mypy/semanal.py @@ -3830,13 +3830,15 @@ def visit_star_expr(self, expr: StarExpr) -> None: expr.expr.accept(self) def visit_yield_from_expr(self, e: YieldFromExpr) -> None: - if not self.is_func_scope(): # not sure + ...
diff --git a/test-data/unit/check-semanal-error.test b/test-data/unit/check-semanal-error.test --- a/test-data/unit/check-semanal-error.test +++ b/test-data/unit/check-semanal-error.test @@ -77,10 +77,47 @@ continue # E: "continue" outside loop [case testYieldOutsideFunction] yield # E: "yield" outside function - -...
crash with generator in list comprehension **Crash Report** possibly related to #10188 **Traceback** ``` mypybug.py:7: error: INTERNAL ERROR -- Please try using mypy master on Github: https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build Please report a bug at https://github.com/...
This is a syntax error in 3.8 and later, presumably because it has no useful behavior: https://docs.python.org/3.10/whatsnew/3.8.html#changes-in-python-behavior. Perhaps mypy should just produce an error for it in any Python version. Hey! I'm relatively new to Open Source Contribution, Is there anything I could be help...
2022-01-23T22:40:12Z
0.940
[ "mypy/test/testcheck.py::TypeCheckSuite::check-semanal-error.test::testMissingModuleImport2", "mypy/test/testcheck.py::TypeCheckSuite::check-semanal-error.test::testMissingModuleImport1", "mypy/test/testcheck.py::TypeCheckSuite::check-semanal-error.test::testMissingModuleImport3", "mypy/test/testcheck.py::Typ...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-semanal-error.test::testYieldOutsideFunction" ]
Python
[]
[]
python/mypy
12,064
python__mypy-12064
[ "12051" ]
af366c0d53b3cfe1bed1baba4e2869460276eb81
diff --git a/mypy/erasetype.py b/mypy/erasetype.py --- a/mypy/erasetype.py +++ b/mypy/erasetype.py @@ -1,10 +1,10 @@ -from typing import Optional, Container, Callable +from typing import Optional, Container, Callable, List, Dict, cast from mypy.types import ( Type, TypeVisitor, UnboundType, AnyType, NoneType, T...
diff --git a/mypy/test/testtypes.py b/mypy/test/testtypes.py --- a/mypy/test/testtypes.py +++ b/mypy/test/testtypes.py @@ -3,7 +3,7 @@ from typing import List, Tuple from mypy.test.helpers import Suite, assert_equal, assert_type, skip -from mypy.erasetype import erase_type +from mypy.erasetype import erase_type, re...
Unexpected type inference changes related to enum value attributes In this example, the behavior changed in #11962: ```py from enum import IntEnum from typing import Any class C(IntEnum): X = 0 Y = 1 Z = 2 def f1(c: C) -> None: x = {'x': c.value} # Old: builtins.dict[builtins.str*, bui...
2022-01-25T10:52:30Z
0.940
[ "mypy/test/testtypes.py::TypesSuite::test_any", "mypy/test/testtypes.py::TypesSuite::test_callable_type_with_var_args", "mypy/test/testtypes.py::TypesSuite::test_simple_unbound_type", "mypy/test/testtypes.py::TypesSuite::test_generic_function_type", "mypy/test/testtypes.py::TypesSuite::test_callable_type", ...
[ "mypy/test/testtypes.py::RemoveLastKnownValueSuite::test_multiple_same_instances", "mypy/test/testtypes.py::RemoveLastKnownValueSuite::test_last_known_values_with_merge", "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumtValueUnionSimplification" ]
Python
[]
[]
python/mypy
12,068
python__mypy-12068
[ "12051" ]
36804497279809675fd4651eefb023aad4918efa
diff --git a/mypy/join.py b/mypy/join.py --- a/mypy/join.py +++ b/mypy/join.py @@ -175,15 +175,15 @@ def join_types(s: Type, t: Type, instance_joiner: Optional[InstanceJoiner] = Non s = mypy.typeops.true_or_false(s) t = mypy.typeops.true_or_false(t) + if isinstance(s, UnionType) and not isinstanc...
diff --git a/test-data/unit/check-enum.test b/test-data/unit/check-enum.test --- a/test-data/unit/check-enum.test +++ b/test-data/unit/check-enum.test @@ -1881,4 +1881,10 @@ class C(IntEnum): def f1(c: C) -> None: x = {'x': c.value} reveal_type(x) # N: Revealed type is "builtins.dict[builtins.str*, builtins...
Unexpected type inference changes related to enum value attributes In this example, the behavior changed in #11962: ```py from enum import IntEnum from typing import Any class C(IntEnum): X = 0 Y = 1 Z = 2 def f1(c: C) -> None: x = {'x': c.value} # Old: builtins.dict[builtins.str*, bui...
2022-01-25T15:36:52Z
0.940
[ "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumCreatedFromFinalValue", "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumCreatedFromStringLiteral", "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumBasics", "mypy/test/testcheck.py::TypeCheckSuite::check-enum....
[ "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumtValueUnionSimplification" ]
Python
[]
[]
python/mypy
12,083
python__mypy-12083
[ "12062" ]
e2852039bafaf0d7463623dd5410c02797eae21b
diff --git a/mypy/stubtest.py b/mypy/stubtest.py --- a/mypy/stubtest.py +++ b/mypy/stubtest.py @@ -1113,19 +1113,27 @@ def get_stub(module: str) -> Optional[nodes.MypyFile]: return _all_stubs.get(module) -def get_typeshed_stdlib_modules(custom_typeshed_dir: Optional[str]) -> List[str]: +def get_typeshed_stdlib...
diff --git a/mypy/test/teststubtest.py b/mypy/test/teststubtest.py --- a/mypy/test/teststubtest.py +++ b/mypy/test/teststubtest.py @@ -948,12 +948,19 @@ def test_missing_stubs(self) -> None: assert "error: not_a_module failed to find stubs" in remove_color_code(output.getvalue()) def test_get_typeshed_s...
stubtest: Honor VERSIONS file for sub-modules **Bug Report** Cf. python/typeshed#6789. Currently, stubtest doesn't honor version ranges in stdlib's `VERSIONS` file. For example, when testing stdlib with Python 3.9, stubtest will complain about `asyncio.mixins failed to find stubs`, even though `asyncio.mixins` is ma...
Cc @sobolevn Thanks, @srittau! I am able to reproduce it locally, let's see why it happens.
2022-01-27T09:27:09Z
0.940
[ "mypy/test/teststubtest.py::StubtestUnit::test_arg_kind", "mypy/test/teststubtest.py::StubtestUnit::test_arg_name", "mypy/test/teststubtest.py::StubtestUnit::test_arg_mismatch", "mypy/test/teststubtest.py::StubtestUnit::test_bad_literal", "mypy/test/teststubtest.py::StubtestUnit::test_basic_good", "mypy/t...
[ "mypy/test/teststubtest.py::StubtestMiscUnit::test_get_typeshed_stdlib_modules" ]
Python
[]
[]
python/mypy
12,118
python__mypy-12118
[ "8926", "8926" ]
6648199ed8f1630e63c08c184939bc93abf513d1
diff --git a/mypy/checker.py b/mypy/checker.py --- a/mypy/checker.py +++ b/mypy/checker.py @@ -67,7 +67,9 @@ CONTRAVARIANT, COVARIANT, GDEF, + IMPLICITLY_ABSTRACT, INVARIANT, + IS_ABSTRACT, LDEF, LITERAL_TYPE, MDEF, @@ -115,7 +117,6 @@ ReturnStmt, StarExpr, Statem...
diff --git a/test-data/unit/check-protocols.test b/test-data/unit/check-protocols.test --- a/test-data/unit/check-protocols.test +++ b/test-data/unit/check-protocols.test @@ -444,7 +444,7 @@ class P(C, Protocol): # E: All bases of a protocol must be protocols class P2(P, D, Protocol): # E: All bases of a protocol must...
Should concrete implementations be required to implement protocol? * Are you reporting a bug, or opening a feature request? Bug * Please insert below the code you are checking with mypy, or a mock-up repro if the source is private. We would appreciate if you try to simplify your case to a minimal repro. ...
I ran into exactly this today. Mypy doesn't recognize the problem. It should! Yeah, this behavior is not what one would expect. Note that if `main` was type checked (with a `-> None` annotation), the missing attribute definition would be caught when constructing an instance of `FrenchPerson`. However, we should probabl...
2022-02-03T16:33:42Z
0.980
[ "mypy/test/testcheck.py::TypeCheckSuite::check-protocols.test::testCannotInstantiateProtocol", "mypy/test/testcheck.py::TypeCheckSuite::check-protocols.test::testMeetProtocolWithProtocol", "mypy/test/testcheck.py::TypeCheckSuite::check-protocols.test::testGenericMethodWithProtocol2", "mypy/test/testcheck.py::...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-protocols.test::testProtocolsCannotInheritFromNormal", "mypy/test/testcheck.py::TypeCheckSuite::check-protocols.test::testEmptyBodyImplicitlyAbstractProtocol", "mypy/test/testcheck.py::TypeCheckSuite::check-protocols.test::testEmptyBodyImplicitlyAbstractProtocolPro...
Python
[]
[]
python/mypy
12,129
python__mypy-12129
[ "12072" ]
b09683cb33ab28b34011acb367161309a1e9af5d
diff --git a/mypy/stubgen.py b/mypy/stubgen.py --- a/mypy/stubgen.py +++ b/mypy/stubgen.py @@ -851,6 +851,12 @@ def visit_class_def(self, o: ClassDef) -> None: base_types.append('metaclass=abc.ABCMeta') self.import_tracker.add_import('abc') self.import_tracker.require_name('abc') ...
diff --git a/test-data/unit/stubgen.test b/test-data/unit/stubgen.test --- a/test-data/unit/stubgen.test +++ b/test-data/unit/stubgen.test @@ -2581,6 +2581,30 @@ def f(x: int, y: int) -> int: ... @t.overload def f(x: t.Tuple[int, int]) -> int: ... +[case testProtocol_semanal] +from typing import Protocol, TypeVar +...
`stubgen` removes `Protocol` from base classes list **Bug Report** Consider the following input: ```python from typing import Protocol class Interface(Protocol): def dummy(self, arg: str) -> str: ... ``` `stubgen` produces: ```python class Interface: def dummy(self, arg: str) -> str: ... ...
This works as a fix: ```diff diff --git a/mypy/stubgen.py b/mypy/stubgen.py index b0a2c4e64..4e1a0fe08 100755 --- a/mypy/stubgen.py +++ b/mypy/stubgen.py @@ -849,6 +849,9 @@ class StubGenerator(mypy.traverser.TraverserVisitor): base_types.append('metaclass=abc.ABCMeta') self.import_tra...
2022-02-05T10:19:59Z
0.950
[ "mypy/test/teststubgen.py::StubgenPythonSuite::stubgen.test::testMultipleVariable", "mypy/test/teststubgen.py::StubgenPythonSuite::stubgen.test::testEmptyFile", "mypy/test/teststubgen.py::StubgenPythonSuite::stubgen.test::testSpecialInternalVar", "mypy/test/teststubgen.py::StubgenPythonSuite::stubgen.test::te...
[ "mypy/test/teststubgen.py::StubgenPythonSuite::stubgen.test::testProtocol_semanal" ]
Python
[]
[]
python/mypy
12,138
python__mypy-12138
[ "12132" ]
91357952db51a2d7f1c72dd5cc04f0fcb58c9248
diff --git a/mypy/checker.py b/mypy/checker.py --- a/mypy/checker.py +++ b/mypy/checker.py @@ -1834,11 +1834,7 @@ def visit_class_def(self, defn: ClassDef) -> None: if typ.is_protocol and typ.defn.type_vars: self.check_protocol_variance(defn) if not defn.has_incompatible_baseclass and def...
diff --git a/test-data/unit/check-enum.test b/test-data/unit/check-enum.test --- a/test-data/unit/check-enum.test +++ b/test-data/unit/check-enum.test @@ -2029,3 +2029,54 @@ class C(Enum): C._ignore_ # E: "Type[C]" has no attribute "_ignore_" [typing fixtures/typing-medium.pyi] + +[case testCanOverrideDunderAttribu...
Overriding non-enumeration attributes in Enum subclass fails **Bug Report** Inheriting an `Enum`-class and overriding, for example, a dunder-attribute fails to typecheck. Although it works fine during runtime. **To Reproduce** ```python from enum import Enum class BaseEnum(Enum): __something__ = 3 ...
@flaeppe are you interested in working on this? 🙂 I could take a swing at it if I find some time, though I'm not too familiar with mypy code so I'm not sure what'll come out of it. If someone else feels like working on it, please go ahead
2022-02-07T07:33:49Z
0.950
[ "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumValueInhomogenous", "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumBasics", "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testIntEnum_functionReturningIntEnum", "mypy/test/testcheck.py::TypeCheckSuite::check-enum....
[ "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testCanOverrideDunderAttributes", "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testCanNotInitialize__members__", "mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testCanOverrideDunderOnNonFirstBaseEnum" ]
Python
[]
[]
python/mypy
12,199
python__mypy-12199
[ "12197" ]
1de5e55fff22b023d54aa700d630befd162db20e
diff --git a/mypy/semanal.py b/mypy/semanal.py --- a/mypy/semanal.py +++ b/mypy/semanal.py @@ -48,7 +48,6 @@ reduce memory use). """ -import copy from contextlib import contextmanager from typing import ( @@ -4791,6 +4790,48 @@ def add_module_symbol(self, module_hidden=module_hidden ...
diff --git a/test-data/unit/check-classes.test b/test-data/unit/check-classes.test --- a/test-data/unit/check-classes.test +++ b/test-data/unit/check-classes.test @@ -7135,24 +7135,20 @@ class B(A): # E: Final class __main__.B has abstract attributes "foo" class C: class C1(XX): pass # E: Name "XX" is not defin...
More crashes in class scoped imports In Python 3 (but not Python 2), it is illegal to do `import *` in class body, but mypy allows it. It also crashes if you do `class X: from os import *`: ``` % python -m mypy -c 'class Capybara: from os import *' --show-traceback <string>:1: error: INTERNAL ERROR -- Please tr...
Okay, so while https://github.com/python/mypy/pull/12023 fixed a bunch of crashes, it also resulted in some new crashes. It also looks like there's some kind of caching bug at play, so make sure to use `--no-incremental` if you're seeing weirdness when debugging. ``` λ mypy -c 'class Foo: from os import *' --show-t...
2022-02-17T05:24:39Z
0.940
[ "mypy/test/testcheck.py::TypeCheckSuite::check-classes.test::testInheritingMethod", "mypy/test/testcheck.py::TypeCheckSuite::check-classes.test::testMethodCall", "mypy/test/testcheck.py::TypeCheckSuite::check-classes.test::testMethodCallWithSubtype", "mypy/test/testcheck.py::TypeCheckSuite::check-classes.test...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-modules.test::testImportWithinClassBody2", "mypy/test/testcheck.py::TypeCheckSuite::check-classes.test::testClassScopeImports", "mypy/test/testcheck.py::TypeCheckSuite::check-classes.test::testClassScopeImportAlias", "mypy/test/testcheck.py::TypeCheckSuite::check...
Python
[]
[]
python/mypy
12,222
python__mypy-12222
[ "12070" ]
feca706d5f2540003ae8b24009d56dac7c067eba
diff --git a/mypy/messages.py b/mypy/messages.py --- a/mypy/messages.py +++ b/mypy/messages.py @@ -954,11 +954,8 @@ def invalid_keyword_var_arg(self, typ: Type, is_mapping: bool, context: Context) if isinstance(typ, Instance) and is_mapping: self.fail('Keywords must be strings', context) ...
diff --git a/test-data/unit/check-kwargs.test b/test-data/unit/check-kwargs.test --- a/test-data/unit/check-kwargs.test +++ b/test-data/unit/check-kwargs.test @@ -350,12 +350,15 @@ class A: pass [builtins fixtures/dict.pyi] [case testInvalidTypeForKeywordVarArg] -from typing import Dict +# flags: --strict-optional ...
Improve the "Argument must be a mapping" error message **Feature** This could also be classified as a bug report, but it's also a feature request. Consider code like this: ```py from typing import Any, Optional def test(**kwargs): ... kwargs: Optional[Any] test(**kwargs) ``` Now, this is obviousl...
Yes, we should improve this. PR welcome! @JelleZijlstra I would like to work on this issue. I am a beginner but really interested in open source. Go for it! I haven't looked at the code for this error, but here's what I would do: - Find the place where the `must be a mapping` error is raised. Start by grepping fo...
2022-02-20T17:34:05Z
0.940
[ "mypy/test/testcheck.py::TypeCheckSuite::check-kwargs.test::testTypeErrorInKeywordArgument", "mypy/test/testcheck.py::TypeCheckSuite::check-kwargs.test::testSimpleKeywordArgument", "mypy/test/testcheck.py::TypeCheckSuite::check-kwargs.test::testTwoKeywordArgumentsNotInOrder", "mypy/test/testcheck.py::TypeChec...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-kwargs.test::testInvalidTypeForKeywordVarArg" ]
Python
[]
[]
python/mypy
12,250
python__mypy-12250
[ "12232" ]
14de8c6f1f24648299528881561ddcd52172701d
diff --git a/mypy/build.py b/mypy/build.py --- a/mypy/build.py +++ b/mypy/build.py @@ -730,20 +730,19 @@ def correct_rel_imp(imp: Union[ImportFrom, ImportAll]) -> str: return new_id res: List[Tuple[int, str, int]] = [] + delayed_res: List[Tuple[int, str, int]] = [] for imp in fil...
diff --git a/test-data/unit/check-errorcodes.test b/test-data/unit/check-errorcodes.test --- a/test-data/unit/check-errorcodes.test +++ b/test-data/unit/check-errorcodes.test @@ -596,10 +596,10 @@ if int() is str(): # E: Non-overlapping identity check (left operand type: "int [builtins fixtures/primitives.pyi] [ca...
Cache causes mypy to fail every 2nd run for module importing from google.cloud **Bug Report** I have a project that imports things from `google.cloud`, which is a namespace package as far as I know. In a certain, very specific configuration mypy fails on every second run. This is very similar to #9852. However, this b...
2022-02-24T09:10:34Z
0.940
[ "mypy/test/testcheck.py::TypeCheckSuite::check-errorcodes.test::testErrorCodeNoteHasNoCode", "mypy/test/testcheck.py::TypeCheckSuite::check-errorcodes.test::testErrorCodeUnclassifiedError", "mypy/test/testcheck.py::TypeCheckSuite::check-errorcodes.test::testErrorCodeUndefinedName", "mypy/test/testcheck.py::Ty...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-errorcodes.test::testErrorCodeMissingModule", "mypy/test/testcmdline.py::PythonCmdlineSuite::cmdline.test::testConfigFollowImportsError", "mypy/test/testsemanal.py::SemAnalErrorSuite::semanal-errors.test::testMissingPackage2", "mypy/test/testpep561.py::PEP561Suit...
Python
[]
[]
python/mypy
12,303
python__mypy-12303
[ "11082" ]
226661f62f365102f5fd913b39b32ed3f12e208b
diff --git a/mypy/stubgen.py b/mypy/stubgen.py --- a/mypy/stubgen.py +++ b/mypy/stubgen.py @@ -649,9 +649,11 @@ def visit_func_def(self, o: FuncDef, is_abstract: bool = False, # type "UnboundType" and will not match. if not isinstance(get_proper_type(annotated_type), AnyType): ...
diff --git a/test-data/unit/stubgen.test b/test-data/unit/stubgen.test --- a/test-data/unit/stubgen.test +++ b/test-data/unit/stubgen.test @@ -2580,3 +2580,8 @@ class A: def f(x: int, y: int) -> int: ... @t.overload def f(x: t.Tuple[int, int]) -> int: ... + +[case testNonDefaultKeywordOnlyArgAfterAsterisk] +def func...
Stubgen moves non default keyword-only argument in front of * <!-- If you're new to mypy and you're not sure whether what you're experiencing is a mypy bug, please see the "Question and Help" form instead. --> **Bug Report** <!-- Note: If the problem you are reporting is about a specific library function,...
2022-03-07T19:01:12Z
0.940
[ "mypy/test/teststubgen.py::StubgenPythonSuite::stubgen.test::testMultipleVariable", "mypy/test/teststubgen.py::StubgenPythonSuite::stubgen.test::testSpecialInternalVar", "mypy/test/teststubgen.py::StubgenPythonSuite::stubgen.test::testEmptyFile", "mypy/test/teststubgen.py::StubgenPythonSuite::stubgen.test::te...
[ "mypy/test/teststubgen.py::StubgenPythonSuite::stubgen.test::testNonDefaultKeywordOnlyArgAfterAsterisk" ]
Python
[]
[]
python/mypy
12,336
python__mypy-12336
[ "12335" ]
7ee84c71e851ce373d1824ecc09332caa373148c
diff --git a/mypy/fastparse.py b/mypy/fastparse.py --- a/mypy/fastparse.py +++ b/mypy/fastparse.py @@ -486,6 +486,7 @@ def fix_function_overloads(self, stmts: List[Statement]) -> List[Statement]: ret: List[Statement] = [] current_overload: List[OverloadPart] = [] current_overload_name: Option...
diff --git a/test-data/unit/check-overloading.test b/test-data/unit/check-overloading.test --- a/test-data/unit/check-overloading.test +++ b/test-data/unit/check-overloading.test @@ -6302,3 +6302,29 @@ if True: def f12(x): ... reveal_type(f12(A())) # N: Revealed type is "__main__.A" [typing fixtures/typing-medi...
0.940: Condition can't be inferred, unable to merge overloads **Bug Report** This might be an issue with beartype, it has been reported there https://github.com/beartype/beartype/issues/112. Since mypy reports an overload error at a line that has no overloads, it might be a mypy error (edit: there are overloads around...
Thanks for the message. I'll take a look
2022-03-11T22:18:30Z
0.950
[ "mypy/test/testcheck.py::TypeCheckSuite::check-overloading.test::testCovariantOverlappingOverloadSignaturesWithAnyType", "mypy/test/testcheck.py::TypeCheckSuite::check-overloading.test::testOverloadNotImportedNoCrash", "mypy/test/testcheck.py::TypeCheckSuite::check-overloading.test::testTypeCheckOverloadWithImp...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-overloading.test::testOverloadIfUnconditionalFuncDef" ]
Python
[]
[]
python/mypy
12,411
python__mypy-12411
[ "12065" ]
8427df1630d434ea7e8778f876a0af024b696c69
diff --git a/mypy/checker.py b/mypy/checker.py --- a/mypy/checker.py +++ b/mypy/checker.py @@ -2103,8 +2103,9 @@ class C(B, A[int]): ... # this is unsafe because... self.msg.cant_override_final(name, base2.name, ctx) if is_final_node(first.node): self.check_if_final_var_override_writ...
diff --git a/test-data/unit/check-attr.test b/test-data/unit/check-attr.test --- a/test-data/unit/check-attr.test +++ b/test-data/unit/check-attr.test @@ -1539,3 +1539,19 @@ n: NoMatchArgs reveal_type(n.__match_args__) # E: "NoMatchArgs" has no attribute "__match_args__" \ # N: Reveale...
Confusing error about __attrs_attrs__ when using multiple inheritance This code now generates an error about class AB: ```py import attr @attr.s class A: x = attr.ib(type=int) @attr.s class B: y = attr.ib(type=int) # Definition of "__attrs_attrs__" in base class "A" is incompatible with definit...
Interesting, I can take a look at this. In runtime, ``` >>> AB.__attrs_attrs__ (Attribute(name='x', default=NOTHING, validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=<class 'int'>, converter=None, kw_only=False, inherited=False, on_s...
2022-03-21T15:37:33Z
0.950
[ "mypy/test/testcheck.py::TypeCheckSuite::check-attr.test::testAttrsInitAttribFalse", "mypy/test/testcheck.py::TypeCheckSuite::check-attr.test::testAttrsNextGenFrozen", "mypy/test/testcheck.py::TypeCheckSuite::check-attr.test::testAttrsForwardReference", "mypy/test/testcheck.py::TypeCheckSuite::check-attr.test...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-attr.test::testAttrsMultipleInheritance", "mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesMultipleInheritanceWithNonDataclass" ]
Python
[]
[]
python/mypy
12,418
python__mypy-12418
[ "10594" ]
3751e382dd3474b75fb4cdfc4f255e433aef555d
diff --git a/mypy/message_registry.py b/mypy/message_registry.py --- a/mypy/message_registry.py +++ b/mypy/message_registry.py @@ -61,6 +61,9 @@ def format(self, *args: object, **kwargs: object) -> "ErrorMessage": ) INCOMPATIBLE_TYPES_IN_ASYNC_FOR: Final = 'Incompatible types in "async for"' +ASYNC_FOR_OUTSIDE_CORO...
diff --git a/test-data/unit/check-async-await.test b/test-data/unit/check-async-await.test --- a/test-data/unit/check-async-await.test +++ b/test-data/unit/check-async-await.test @@ -825,3 +825,42 @@ def bar() -> None: [builtins fixtures/async_await.pyi] [typing fixtures/typing-async.pyi] + +[case testAsyncForOutsi...
async for/async with are allowed in non-async functions **To Reproduce** ``` async def b(): for i in range(5): yield i def a(): return [x async for x in b()] ``` **Expected Behavior** Syntax error. When trying to run with python this code gives a syntax error. **Actual Behavior** Passed with ...
Yeah, more generally it looks like we don't enforce that async for/async with are only used in async functions. I would like to take up this issue. It's just that I need a few doubts cleared. You're stating that the compiler throws an error stating async is not allowed outside an async function, but mypy doesn't do...
2022-03-21T19:27:26Z
0.950
[ "mypy/test/testcheck.py::TypeCheckSuite::check-async-await.test::testAsyncDefPass", "mypy/test/testcheck.py::TypeCheckSuite::check-async-await.test::testAwaitIteratorError", "mypy/test/testcheck.py::TypeCheckSuite::check-async-await.test::testAwaitAnyContext", "mypy/test/testcheck.py::TypeCheckSuite::check-as...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-async-await.test::testAsyncWithOutsideCoroutine", "mypy/test/testcheck.py::TypeCheckSuite::check-async-await.test::testAsyncForOutsideCoroutine" ]
Python
[]
[]
python/mypy
12,435
python__mypy-12435
[ "12434" ]
fd8a15e1abdd2bb4f75c3a6319ebfba233e1fe8e
diff --git a/mypy/checker.py b/mypy/checker.py --- a/mypy/checker.py +++ b/mypy/checker.py @@ -600,7 +600,8 @@ def check_overlapping_overloads(self, defn: OverloadedFuncDef) -> None: self.msg.overloaded_signatures_arg_specific(i + 1, defn.impl) # Is the overload alternative's ret...
diff --git a/test-data/unit/check-overloading.test b/test-data/unit/check-overloading.test --- a/test-data/unit/check-overloading.test +++ b/test-data/unit/check-overloading.test @@ -6328,3 +6328,24 @@ if True: def f2(x): ... if True: def f2(x): ... # E: Name "f2" already defined on line 17 + +[case testOverloa...
Let overload item have a wider return type than implementation A wider return type can be useful if a decorator gets a more precise error type as part of a typeshed update. @wrobell reported this concrete example in https://github.com/python/mypy/issues/12021#issuecomment-1065542606: ```py import typing as tp f...
2022-03-23T16:11:53Z
0.950
[ "mypy/test/testcheck.py::TypeCheckSuite::check-overloading.test::testPartiallyContravariantOverloadSignatures", "mypy/test/testcheck.py::TypeCheckSuite::check-overloading.test::testOverloadNotImportedNoCrash", "mypy/test/testcheck.py::TypeCheckSuite::check-overloading.test::testOverloadWithOverlappingItemsAndAn...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-overloading.test::testOverloadItemHasMoreGeneralReturnType" ]
Python
[]
[]
python/mypy
12,463
python__mypy-12463
[ "11893" ]
c7559283995ea020afbb82d92cad538f0b174913
diff --git a/mypy/traverser.py b/mypy/traverser.py --- a/mypy/traverser.py +++ b/mypy/traverser.py @@ -368,8 +368,20 @@ def has_return_statement(fdef: FuncBase) -> bool: return seeker.found -class YieldSeeker(TraverserVisitor): +class FuncCollectorBase(TraverserVisitor): + def __init__(self) -> None: + ...
diff --git a/test-data/unit/stubgen.test b/test-data/unit/stubgen.test --- a/test-data/unit/stubgen.test +++ b/test-data/unit/stubgen.test @@ -2619,3 +2619,12 @@ class PT(Protocol[T, T2]): def func(*, non_default_kwarg: bool, default_kwarg: bool = True): ... [out] def func(*, non_default_kwarg: bool, default_kwarg: ...
Stubgen applies Generator type to function with nested generator **Bug Report** When stubgen encounters a function with a nested generator-function, that generator type is used for the return type of the function, even if the function itself does not return a generator. **To Reproduce** 1. Create a file `gener...
2022-03-26T16:44:50Z
0.950
[ "mypy/test/teststubgen.py::StubgenPythonSuite::stubgen.test::testPreserveVarAnnotation", "mypy/test/teststubgen.py::StubgenPythonSuite::stubgen.test::testEmptyFile", "mypy/test/teststubgen.py::StubgenPythonSuite::stubgen.test::testMultipleVariable", "mypy/test/teststubgen.py::StubgenPythonSuite::stubgen.test:...
[ "mypy/test/teststubgen.py::StubgenPythonSuite::stubgen.test::testNestedGenerator" ]
Python
[]
[]
python/mypy
12,503
python__mypy-12503
[ "12489" ]
132b8e527730b654a3f3d04684bebc9daff6cabd
diff --git a/mypy/plugins/dataclasses.py b/mypy/plugins/dataclasses.py --- a/mypy/plugins/dataclasses.py +++ b/mypy/plugins/dataclasses.py @@ -230,7 +230,8 @@ def transform(self) -> bool: if (decorator_arguments['match_args'] and ('__match_args__' not in info.names or info.na...
diff --git a/mypy/test/testmerge.py b/mypy/test/testmerge.py --- a/mypy/test/testmerge.py +++ b/mypy/test/testmerge.py @@ -7,7 +7,6 @@ from mypy import build from mypy.build import BuildResult from mypy.modulefinder import BuildSource -from mypy.defaults import PYTHON3_VERSION from mypy.errors import CompileError ...
mypy generates `__match_args__` for dataclasses and `NamedTuple`s on Python <3.10 **Bug Report** Not a big deal, but mypy appears to generate `__match_args__` for dataclasses and `NamedTuple`s even when running with `--python-version` set to 3.9: ```python from dataclasses import dataclass from typing import Na...
This is probably a good issue for someone new to mypy.
2022-03-31T18:55:18Z
0.970
[ "mypy/test/testmerge.py::ASTMergeSuite::merge.test::testFunction", "mypy/test/testmerge.py::ASTMergeSuite::merge.test::testTypeType_types", "mypy/test/testmerge.py::ASTMergeSuite::merge.test::testLiteralMerge", "mypy/test/testmerge.py::ASTMergeSuite::merge.test::testClass", "mypy/test/testcheck.py::TypeChec...
[ "mypy/test/testmerge.py::ASTMergeSuite::merge.test::testNamedTupleOldVersion_typeinfo", "mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassWithMatchArgsOldVersion", "mypy/test/testcheck.py::TypeCheckSuite::check-namedtuple.test::testNamedTupleHasNoMatchArgsOldVersion", "mypy/test/te...
Python
[]
[]
python/mypy
12,548
python__mypy-12548
[ "12542" ]
222029b07e0fdcb3c174f15b61915b3b2e1665ca
diff --git a/mypy/constraints.py b/mypy/constraints.py --- a/mypy/constraints.py +++ b/mypy/constraints.py @@ -407,6 +407,10 @@ def visit_unpack_type(self, template: UnpackType) -> List[Constraint]: raise NotImplementedError def visit_parameters(self, template: Parameters) -> List[Constraint]: + ...
diff --git a/test-data/unit/check-parameter-specification.test b/test-data/unit/check-parameter-specification.test --- a/test-data/unit/check-parameter-specification.test +++ b/test-data/unit/check-parameter-specification.test @@ -1026,3 +1026,17 @@ P = ParamSpec("P") def x(f: Callable[Concatenate[int, Concatenate[i...
"Parameters cannot be constrained" with generic ParamSpec **Crash Report** Ran into this one while implementing generic ParamSpec after #11847 was merged this morning. /CC: @A5rocks **Traceback** ``` version: 0.950+dev.e7e1db6a5ad3d07a7a4d46cf280e972f2342a90f Traceback (most recent call last): ... Fil...
2022-04-08T03:43:15Z
0.950
[ "mypy/test/testcheck.py::TypeCheckSuite::check-parameter-specification.test::testInvalidParamSpecType", "mypy/test/testcheck.py::TypeCheckSuite::check-parameter-specification.test::testBasicParamSpec", "mypy/test/testcheck.py::TypeCheckSuite::check-parameter-specification.test::testParamSpecLocations", "mypy/...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-parameter-specification.test::testPropagatedAnyConstraintsAreOK" ]
Python
[]
[]
python/mypy
12,558
python__mypy-12558
[ "12108" ]
ad177f99fd3322072e389a1a7432ee7b15c84472
diff --git a/mypy/config_parser.py b/mypy/config_parser.py --- a/mypy/config_parser.py +++ b/mypy/config_parser.py @@ -24,8 +24,8 @@ _INI_PARSER_CALLABLE: _TypeAlias = Callable[[Any], _CONFIG_VALUE_TYPES] -def parse_version(v: str) -> Tuple[int, int]: - m = re.match(r'\A(\d)\.(\d+)\Z', v) +def parse_version(v: ...
diff --git a/test-data/unit/cmdline.test b/test-data/unit/cmdline.test --- a/test-data/unit/cmdline.test +++ b/test-data/unit/cmdline.test @@ -561,6 +561,15 @@ main.py:1: error: Cannot find implementation or library stub for module named "a main.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#m...
Friendlier error when 3.10 is parsed as float in pyproject.toml **Bug Report** <!-- Note: If the problem you are reporting is about a specific library function, then the typeshed tracker is better suited for this report: https://github.com/python/typeshed/issues --> Running mypy with Python 3.10 and `python_ve...
You need to quote it as `"3.10"`, because it's a float! We can probably put a special-case message here to make that clear though. Changing it to: ```toml # Specifies the Python version used to parse and check the target program. python_version = "3.10" ``` Indeed fixes the problem. In hindsight it makes total...
2022-04-10T21:50:54Z
0.960
[ "mypy/test/testcmdline.py::PythonCmdlineSuite::cmdline.test::testConfigErrorNoSection", "mypy/test/testcmdline.py::PythonCmdlineSuite::cmdline.test::testErrorContextConfig", "mypy/test/testcmdline.py::PythonCmdlineSuite::cmdline.test::testCmdlineNonPackageContainingPackage", "mypy/test/testcmdline.py::PythonC...
[ "mypy/test/testcmdline.py::PythonCmdlineSuite::cmdline.test::testPythonVersionWrongFormatPyProjectTOML" ]
Python
[]
[]
python/mypy
12,590
python__mypy-12590
[ "12588" ]
44993e6a18f852a9296786267ecf26ea730b4f31
diff --git a/mypy/checkpattern.py b/mypy/checkpattern.py --- a/mypy/checkpattern.py +++ b/mypy/checkpattern.py @@ -396,8 +396,7 @@ def visit_mapping_pattern(self, o: MappingPattern) -> PatternType: if is_subtype(current_type, mapping) and isinstance(current_type, Instance): mapping_inst = ...
diff --git a/test-data/unit/check-selftype.test b/test-data/unit/check-selftype.test --- a/test-data/unit/check-selftype.test +++ b/test-data/unit/check-selftype.test @@ -893,11 +893,14 @@ from typing import Generic, TypeVar, Tuple T = TypeVar('T') S = TypeVar('S') U = TypeVar('U') +V = TypeVar('V') class C(Gener...
Invalid type inference for zip in a generic class The inferred type is wrong here, after the recent typeshed sync: ```py from typing import TypeVar, Generic, List T = TypeVar('T') class C(Generic[T]): a: List[T] b: List[str] def f(self) -> None: for x, y in zip(self.a, self.b): ...
I think that this is caused by confusion between type variables of different classes (`_T_co` vs `T`) that share the same type variable id. A potential fix for this could be to give each class type variable a unique ID. This way there shouldn't be any confusion. This would probably also imply updating the type to s...
2022-04-14T16:53:31Z
0.960
[ "mypy/test/testcheck.py::TypeCheckSuite::check-selftype.test::testSelfTypeGeneric", "mypy/test/testcheck.py::TypeCheckSuite::check-selftype.test::testSelfTypeInstance", "mypy/test/testcheck.py::TypeCheckSuite::check-selftype.test::testSelfTypeClass", "mypy/test/testcheck.py::TypeCheckSuite::check-selftype.tes...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-selftype.test::testSelfTypeMultipleTypeVars", "mypy/test/testcheck.py::TypeCheckSuite::check-selftype.test::testSelfTypeInGenericClassUsedFromAnotherGenericClass1" ]
Python
[]
[]
python/mypy
12,607
python__mypy-12607
[ "12606" ]
0df8cf532918f888610a5afd7bb88192712de984
diff --git a/mypy/fastparse.py b/mypy/fastparse.py --- a/mypy/fastparse.py +++ b/mypy/fastparse.py @@ -496,18 +496,9 @@ def fix_function_overloads(self, stmts: List[Statement]) -> List[Statement]: if_overload_name: Optional[str] = None if_block_with_overload: Optional[Block] = None ...
diff --git a/test-data/unit/check-overloading.test b/test-data/unit/check-overloading.test --- a/test-data/unit/check-overloading.test +++ b/test-data/unit/check-overloading.test @@ -6349,3 +6349,142 @@ def g(x: int) -> str: ... def g(x: int = 0) -> int: # E: Overloaded function implementation cannot produce return...
Error merging nested overloads **Bug Report** Mypy can't merge nested overloads. Those can happen if all are wrapped with `if TYPE_CHECKING` and combined with a nested conditional overload. https://mypy.readthedocs.io/en/stable/more_types.html#conditional-overloads **=> I'm working on a fix already and plan to...
2022-04-17T10:29:46Z
0.960
[ "mypy/test/testcheck.py::TypeCheckSuite::check-overloading.test::testOverloadNotImportedNoCrash", "mypy/test/testcheck.py::TypeCheckSuite::check-overloading.test::testCovariantOverlappingOverloadSignaturesWithSomeSameArgTypes", "mypy/test/testcheck.py::TypeCheckSuite::check-overloading.test::testTypeCheckOverlo...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-overloading.test::testOverloadIfNestedOk" ]
Python
[]
[]
python/mypy
12,704
python__mypy-12704
[ "12689" ]
33dbbd2cde45fe688a716f5d10e51d1bd6a0b096
diff --git a/mypy/semanal.py b/mypy/semanal.py --- a/mypy/semanal.py +++ b/mypy/semanal.py @@ -1894,10 +1894,14 @@ def process_imported_symbol(self, fullname: str, module_public: bool, context: ImportBase) -> None: - ...
diff --git a/test-data/unit/check-modules.test b/test-data/unit/check-modules.test --- a/test-data/unit/check-modules.test +++ b/test-data/unit/check-modules.test @@ -1929,6 +1929,28 @@ from package import mod as mod from package import mod as internal_detail [builtins fixtures/module.pyi] +[case testNoReExportUnre...
`from module import submodule` implicit reexport is allowed **Bug Report** `mypy --no-implicit-reexport` doesn't catch reexports written in the form of `from module import submodule`. **To Reproduce** ```python # pkg/lib.py # implicit re-exports import requests import requests as demands import requests.s...
2022-05-01T05:06:49Z
0.960
[ "mypy/test/testcheck.py::TypeCheckSuite::check-modules.test::testEllipsisDefaultArgValueInNonStub", "mypy/test/testcheck.py::TypeCheckSuite::check-modules.test::testConditionalFunctionDefinitionAndImports", "mypy/test/testcheck.py::TypeCheckSuite::check-modules.test::testAccessingUnknownModuleFromOtherModule", ...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-modules.test::testNoReExportUnrelatedModule", "mypy/test/testcheck.py::TypeCheckSuite::check-modules.test::testNoReExportUnrelatedSiblingPrefix" ]
Python
[]
[]
python/mypy
12,724
python__mypy-12724
[ "12474" ]
9f8b814fc5b3bb8daf0ef04aca3dfd1fb056bc8b
diff --git a/mypy/semanal.py b/mypy/semanal.py --- a/mypy/semanal.py +++ b/mypy/semanal.py @@ -4927,7 +4927,7 @@ def _get_node_for_class_scoped_import( # when it can also be a FuncBase. Once fixed, `f` in the following can be removed. # See also https://github.com/mypyc/mypyc/issues/892 f = c...
diff --git a/test-data/unit/check-classes.test b/test-data/unit/check-classes.test --- a/test-data/unit/check-classes.test +++ b/test-data/unit/check-classes.test @@ -7284,3 +7284,19 @@ def meth1(self: Any, y: str) -> str: ... T = TypeVar("T") def meth2(self: Any, y: T) -> T: ... + +[case testClassScopeImportWithWr...
INTERNAL ERROR on class scoped import of a decorated function **Crash Report** After version 0.940, In #12023 and #12199, `mypy` disabled class scoped import. But, I found in a decorated function it will still raise an INTERNAL ERROR **Traceback** ``` (Insert traceback and other messages from mypy here -- use...
Cc. @hauntsaninja
2022-05-03T19:53:20Z
0.960
[ "mypy/test/testcheck.py::TypeCheckSuite::check-classes.test::testBuiltinStaticMethod", "mypy/test/testcheck.py::TypeCheckSuite::check-classes.test::testOverride__init_subclass__WithDifferentSignature", "mypy/test/testcheck.py::TypeCheckSuite::check-classes.test::testDeepInheritanceHierarchy", "mypy/test/testc...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-classes.test::testClassScopeImportWithWrapperAndError" ]
Python
[]
[]
python/mypy
12,741
python__mypy-12741
[ "5653" ]
4f07c79aea0fef61ab649d6acedf01186f1054eb
diff --git a/mypy/types.py b/mypy/types.py --- a/mypy/types.py +++ b/mypy/types.py @@ -14,7 +14,7 @@ import mypy.nodes from mypy.state import state from mypy.nodes import ( - INVARIANT, SymbolNode, FuncDef, + INVARIANT, SymbolNode, FuncDef, FakeInfo, ArgKind, ARG_POS, ARG_STAR, ARG_STAR2, ) from mypy.ut...
diff --git a/test-data/unit/check-typeddict.test b/test-data/unit/check-typeddict.test --- a/test-data/unit/check-typeddict.test +++ b/test-data/unit/check-typeddict.test @@ -221,6 +221,17 @@ reveal_type(d) # N: Revealed type is "TypedDict('__main__.D', {'y': builtins.in [builtins fixtures/dict.pyi] [typing fixtures...
Crash on definition of TypedDict method I'm not sure if this is a bug or a feature, but I was considering migrating from NamedTuple to TypedDict, and ran into a problem where **methods** don't seem to be supported on TypedDicts. ```python class User(TypedDict): id: str firstName: str lastName: str ...
Also, when used as a var-keyword param, TypedDict doesn't work as I'd expect it to: ```python class LoginParams(TypedDict): emailAddress: str password: str async def resolve_login( root: None, info: GraphQLResolveInfo, ctx: Context, **params: LoginParams ) -> typing.Optional[UserType]: user ...
2022-05-07T11:36:59Z
0.960
[ "mypy/test/testcheck.py::TypeCheckSuite::check-typeddict.test::testCanCreateTypedDictWithSubclass", "mypy/test/testcheck.py::TypeCheckSuite::check-typeddict.test::testCanConvertTypedDictToCompatibleMapping", "mypy/test/testcheck.py::TypeCheckSuite::check-typeddict.test::testCannotCreateTypedDictWithDuplicateKey...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-typeddict.test::testTypedDictWithClassmethodAlternativeConstructorDoesNotCrash" ]
Python
[]
[]
python/mypy
12,745
python__mypy-12745
[ "12678" ]
03638dd670373db0b8f00cc3bcec256d09729d06
diff --git a/mypy/types.py b/mypy/types.py --- a/mypy/types.py +++ b/mypy/types.py @@ -2760,6 +2760,7 @@ def get_proper_types( TypeTranslator as TypeTranslator, TypeVisitor as TypeVisitor, ) +from mypy.typetraverser import TypeTraverserVisitor class TypeStrVisitor(SyntheticTypeVisitor[str]): @@ -3122,6 ...
diff --git a/test-data/unit/check-generics.test b/test-data/unit/check-generics.test --- a/test-data/unit/check-generics.test +++ b/test-data/unit/check-generics.test @@ -648,6 +648,30 @@ reveal_type(f3()) # N: Revealed type is "Union[builtins.int, __main__.Node[built [builtins fixtures/list.pyi] +[case testGeneri...
Can not find "numpy.core._multiarray_umath" if numpy is installed via pip with --target argument. <!-- If you're new to mypy and you're not sure whether what you're experiencing is a mypy bug, please see the "Question and Help" form instead. Please also consider: - checking our common issues page: https:/...
2022-05-07T19:22:06Z
0.980
[ "mypy/test/testcheck.py::TypeCheckSuite::check-generics.test::testMultipleGenericTypeParametersWithMethods", "mypy/test/testcheck.py::TypeCheckSuite::check-generics.test::testTypeApplicationArgTypes", "mypy/test/testcheck.py::TypeCheckSuite::check-generics.test::testOperatorAssignmentWithIndexLvalue2", "mypy/...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-generics.test::testGenericTypeAliasesWithNestedArgs" ]
Python
[]
[]
python/mypy
12,762
python__mypy-12762
[ "12685" ]
e1c03ab0f37495ef4072892778ab126d04860814
diff --git a/mypy/plugin.py b/mypy/plugin.py --- a/mypy/plugin.py +++ b/mypy/plugin.py @@ -692,9 +692,33 @@ def get_class_decorator_hook(self, fullname: str The plugin can modify a TypeInfo _in place_ (for example add some generated methods to the symbol table). This hook is called after the class b...
diff --git a/test-data/unit/check-dataclasses.test b/test-data/unit/check-dataclasses.test --- a/test-data/unit/check-dataclasses.test +++ b/test-data/unit/check-dataclasses.test @@ -1207,7 +1207,7 @@ class A2: from dataclasses import dataclass @dataclass -class A: # E: Name "x" already defined (possibly by an imp...
Crash involving dataclasses, generics, forward references Running master MyPy 0.960 on [the latest efax 1.6.3](https://github.com/NeilGirdhar/efax) gives ```shell ❯ git clone git@github.com:NeilGirdhar/efax.git ❯ cd efax ❯ mypy efax --show-traceback efax/_src/distributions/dirichlet.py:29: error: INTERNAL ERROR --...
I briefly tried to make an MWE, but was unsuccessful. Looks like this is a regression between 0.942 and 0.950 This bisects to https://github.com/python/mypy/pull/12656 Okay, took another look at this and got a small repro: ``` from dataclasses import dataclass from typing import Generic, TypeVar T = TypeVar("T"...
2022-05-10T15:45:06Z
0.960
[ "mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesBasic", "mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesBadInit", "mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesDefaultFactoryTypeChecking", "mypy/test/testcheck.py...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesInheritingDuplicateField", "mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassGenericInheritanceSpecialCase2", "mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassGenericInheritan...
Python
[]
[]
python/mypy
12,767
python__mypy-12767
[ "11728" ]
03901ef657daf6f477e6fe933c42ac270cf5034b
diff --git a/mypy/plugins/default.py b/mypy/plugins/default.py --- a/mypy/plugins/default.py +++ b/mypy/plugins/default.py @@ -96,7 +96,6 @@ def get_class_decorator_hook(self, fullname: str ) -> Optional[Callable[[ClassDefContext], None]]: from mypy.plugins import attrs ...
diff --git a/test-data/unit/check-functools.test b/test-data/unit/check-functools.test --- a/test-data/unit/check-functools.test +++ b/test-data/unit/check-functools.test @@ -132,3 +132,24 @@ from typing import TypeVar, Generic _T = TypeVar('_T') class cached_property(Generic[_T]): ... [builtins fixtures/property.py...
Crash when using total_ordering and a Generic class **Crash Report** When using a test snippet that uses `functools.total_ordering` and a `Generic` class whose `TypeVar` is bound by some other class, there is an internal crash in mypy. The reproduction cases are below the traceback. This may be related to #8539, ...
Same assertion is hit in #12113, #10140, #10672, #12252 and #12112
2022-05-11T13:19:30Z
0.960
[ "mypy/test/testcheck.py::TypeCheckSuite::check-functools.test::testTotalOrderingNonCallable", "mypy/test/testcheck.py::TypeCheckSuite::check-functools.test::testTotalOrderingLambda", "mypy/test/testcheck.py::TypeCheckSuite::check-functools.test::testTotalOrderingReturnNotBool", "mypy/test/testcheck.py::TypeCh...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-functools.test::testTotalOrderingWithForwardReference" ]
Python
[]
[]
python/mypy
12,792
python__mypy-12792
[ "12544" ]
7fbf4deb845d6041700d1addc6eaa2097560f0f3
diff --git a/mypy/plugins/dataclasses.py b/mypy/plugins/dataclasses.py --- a/mypy/plugins/dataclasses.py +++ b/mypy/plugins/dataclasses.py @@ -5,7 +5,7 @@ from mypy.nodes import ( ARG_OPT, ARG_NAMED, ARG_NAMED_OPT, ARG_POS, ARG_STAR, ARG_STAR2, MDEF, - Argument, AssignmentStmt, CallExpr, Context, Expressi...
diff --git a/test-data/unit/check-dataclasses.test b/test-data/unit/check-dataclasses.test --- a/test-data/unit/check-dataclasses.test +++ b/test-data/unit/check-dataclasses.test @@ -513,6 +513,34 @@ Application.COUNTER = 1 [builtins fixtures/dataclasses.pyi] +[case testTypeAliasInDataclassDoesNotCrash] +# flags: ...
Crash when using `TypeAlias` inside a dataclass **Crash Report** The following snippet of code causes a crash: ```python from dataclasses import dataclass from typing import TypeAlias class Foo: x = 1 @dataclass class A: ShortName: TypeAlias = Foo var: int = ShortName.x ``` It [doesn't...
2022-05-15T09:56:04Z
0.960
[ "mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesBadInit", "mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesBasic", "mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesDefaultFactoryTypeChecking", "mypy/test/testcheck.py...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testTypeAliasInDataclassDoesNotCrash" ]
Python
[]
[ "https://mypy-play.net/?mypy=latest&python=3.10&flags=show-traceback&gist=8d5e69cc29a4823717a6f377244c121e" ]
python/mypy
12,804
python__mypy-12804
[ "11121" ]
7bd6fdd326b6a06795edb46a5c74fc5cdeb87cc9
diff --git a/mypy/semanal_namedtuple.py b/mypy/semanal_namedtuple.py --- a/mypy/semanal_namedtuple.py +++ b/mypy/semanal_namedtuple.py @@ -186,11 +186,16 @@ def check_namedtuple(self, # Error. Construct dummy return value. if var_name: name = var_name + if is_fu...
diff --git a/test-data/unit/check-incremental.test b/test-data/unit/check-incremental.test --- a/test-data/unit/check-incremental.test +++ b/test-data/unit/check-incremental.test @@ -5711,3 +5711,32 @@ class C: [builtins fixtures/dict.pyi] [out2] tmp/a.py:2: error: "object" has no attribute "xyz" + +[case testIncrem...
"AssertionError: Cannot find component" for local namedtuple <!-- Use this form only if mypy reports an "INTERNAL ERROR" and/or gives a traceback. Please include the traceback and all other messages below (use `mypy --show-traceback`). --> **Crash Report** mypy crashes when inheriting from a locally define...
2022-05-17T16:22:20Z
0.960
[ "mypy/test/testcheck.py::TypeCheckSuite::check-incremental.test::testIncrementalEmpty", "mypy/test/testcheck.py::TypeCheckSuite::check-incremental.test::testIncrementalSilencedModuleNoLongerCausesError", "mypy/test/testcheck.py::TypeCheckSuite::check-incremental.test::testIncrementalSubmoduleParentBackreference...
[ "mypy/test/testcheck.py::TypeCheckSuite::check-incremental.test::testIncrementalInvalidNamedTupleInUnannotatedFunction" ]
Python
[]
[]