Title: Regression in PyArray.pyset() for Boolean output setter · Issue #411 · jython/jython · GitHub
Open Graph Title: Regression in PyArray.pyset() for Boolean output setter · Issue #411 · jython/jython
X Title: Regression in PyArray.pyset() for Boolean output setter · Issue #411 · jython/jython
Description: Jython 2.7.4 breaks old (proper) behavior exhibited by 2.5.2 and below for java receiver type expecting boolean[] array causing regression. Jython 2.7.4 impl: (broken) jython/src/org/python/core/PyArray.java Lines 2213 to 2220 in 3f256f4...
Open Graph Description: Jython 2.7.4 breaks old (proper) behavior exhibited by 2.5.2 and below for java receiver type expecting boolean[] array causing regression. Jython 2.7.4 impl: (broken) jython/src/org/python/core/Py...
X Description: Jython 2.7.4 breaks old (proper) behavior exhibited by 2.5.2 and below for java receiver type expecting boolean[] array causing regression. Jython 2.7.4 impl: (broken) jython/src/org/python/core/Py...
Opengraph URL: https://github.com/jython/jython/issues/411
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Regression in PyArray.pyset() for Boolean output setter","articleBody":"Jython 2.7.4 breaks old (proper) behavior exhibited by 2.5.2 and below for java receiver type expecting boolean[] array causing regression.\n\n**Jython 2.7.4 impl**: (broken)\nhttps://github.com/jython/jython/blob/3f256f4a79c828d8f1a3f3b95cad8c55ba1ddd0b/src/org/python/core/PyArray.java#L2213-L2220\n\n**Jython 2.5.2 impl**: (works)\nhttps://github.com/jython/jython/blob/85c0618a617f742b67e457e2674a88feba49e9b8/src/org/python/core/PyArray.java#L1470-L1477\n\n\nIn jython 2.5.2, for boolean array java receiver type, `ex: someFunc(boolean[] array)`, the input value whatever it was ie primitive-java/object-java/python type was being converted to java type using Py.tojava(value, type).\n\nBut in jython 2.7.4, for the same receiver type, the input value matters if it is java-primitive/java-object/python type since not all of the java-Object types implement __nonzero__() and PyBoolean type is for python boolean values, currently the incoming java-object values all default to PyObject base impl for __nonzero() **which just returns true always**.\nhttps://github.com/jython/jython/blob/3f256f4a79c828d8f1a3f3b95cad8c55ba1ddd0b/src/org/python/core/PyObject.java#L316-L318\n\nThis causes the inputs to the java-receiver function be all true, irrespective of what input was supplied from python script.\nex:\n\n```java\npublic class UnitUnderTest{\n public void someFunc(boolean[] array){\n if (array == null) {\n System.out.println(\"null\");\n return;\n }\n\n System.out.print(\"[\");\n for (int i = 0; i \u003c array.length; i++) {\n System.out.print(array[I]);\n if (i \u003c (array.length-1)){\n System.out.print(\", \");\n }\n }\n System.out.print(\"]\");\n }\n}\n```\n\n```python\nimport java.lang.Boolean as Boolean\nimport java.lang.Boolean as Integer\n\na = [Boolean(0), Boolean(1), Boolean(0)] # java-object [\u003cjava.lang.Boolean\u003e, \u003cjava.lang.Boolean\u003e, \u003cjava.lang.Boolean\u003e]\nb = [0, 1, 0] # python [\u003cinteger\u003e, \u003cinteger\u003e, \u003cinteger\u003e]\nc = [Integer(0), Integer(1), Integer(0)] # java-object [\u003cjava.lang.Integer\u003e, \u003cjava.lang.Integer\u003e, \u003cjava.lang.Integer\u003e]\n# d = [boolean(0)] # INVALID - because python doesnt have a boolean keyword and cannot be imported as object unlike java.lang.Boolean. \n\nimport UnitUnderTest as uut\n\nuut.someFunc(a) # prints all values as true ?!\nuut.someFunc(b) # prints properly due to int values being python type (PyInteger) and all python types implement non-zero()\nuut.someFunc(c) # prints all values as true ?! \n```\n\n```python\n\n######## jython 2.5.2 output #######\n[false, true, false] # WORKS\n[false, true, false] # WORKS\nERROR: Arg Integer can't be coerced into boolean. # WORKS! by throwing error\n\n```\n\n```python\n\n######## jython 2.7.4 output #######\n[true, true, true] # FAIL!\n[false, true, false] # WORKS\n[true, true, true] # FAIL!\n\n```","author":{"url":"https://github.com/mahee96","@type":"Person","name":"mahee96"},"datePublished":"2026-01-09T17:48:20.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/411/jython/issues/411"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ad606155-dbd7-cb05-6ff4-f3c17dd3d792 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DE2C:54B94:8EE5CF:C7FFFE:696E61E6 |
| html-safe-nonce | d3a0a2ff48a2486aaec2ab0e593b2e2dc006391ad6b8c415443a87de19cb38a7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERTJDOjU0Qjk0OjhFRTVDRjpDN0ZGRkU6Njk2RTYxRTYiLCJ2aXNpdG9yX2lkIjoiNjA5MjE2NzQxODk5NTQzMzk1OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e918d5307012e979b8d1d0d35f571e728c4441f7d8da9df1e4112605d4a6129d |
| hovercard-subject-tag | issue:3797818648 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/jython/jython/411/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cdf89f3af26cd64952825c264792d7939667df9dfe01e910a5ece3302434610a/jython/jython/issues/411 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cdf89f3af26cd64952825c264792d7939667df9dfe01e910a5ece3302434610a/jython/jython/issues/411 |
| og:image:alt | Jython 2.7.4 breaks old (proper) behavior exhibited by 2.5.2 and below for java receiver type expecting boolean[] array causing regression. Jython 2.7.4 impl: (broken) jython/src/org/python/core/Py... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mahee96 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 99a4a74f92e7618f6e15b4dbb9f4470c8d31701a90d89c21ff31970528b7f0c3 |
| turbo-cache-control | no-preview |
| go-import | github.com/jython/jython git https://github.com/jython/jython.git |
| octolytics-dimension-user_id | 10533356 |
| octolytics-dimension-user_login | jython |
| octolytics-dimension-repository_id | 282480317 |
| octolytics-dimension-repository_nwo | jython/jython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 282480317 |
| octolytics-dimension-repository_network_root_nwo | jython/jython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ef0d97829e997c64864f25a29b00067f5dc3a4c4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width