Possible bug? SystemError: unknown opcode

已回答

Running the debugger on this section of code:

for int in int_list:
command_list = [] # clear the command list for each interface
sh_run_int = ssh_conn.send_command('sh run int {0}'.format(int)) # get the int config
int_configs[int] = sh_run_int # add the int and config to the dictionary
if 'ip flow ingress' in sh_run_int:
sh_run_int = '''Building configuration...

Current configuration : 330 bytes
!
interface GigabitEthernet0/0
description TEST-ES-01 G1/0/1
no ip address
ip directed-broadcast
ip nbar protocol-discovery
ip flow monitor NTA-MONITOR input
ip flow monitor LIVEACTION-FLOWMONITOR input
ip flow monitor LIVEACTION-FLOWMONITOR output
load-interval 30
duplex full
speed 1000
no snmp trap link-status
end
'''

I get "SystemError: unknown opcode". Launching a Python console and running this code doesn't produce any errors. 

I'm running:
Python 3.6.1
PyCharm 2017.1.1
Build #PY-171.4163.6, built on April 11, 2017
JRE: 1.8.0_121-b13 x86
JVM: Java HotSpot(TM) Client VM by Oracle Corporation
Windows 7 6.1

7

Well then you should go "diff" your code as the issue started with 2017 version.

1

I am able to reproduce this 100% with this code:

test_filter.py:

from unittest import TestCase
from .dummy import Dummy


class TestDeterministicFilter(TestCase):


def test_trial(self):
text = 'De Standaard - 17/06/17@10u07 Eenmalige tentoonstelling in New York '
Dummy._re_re_fun(text)
dummy.py:

import re
from logging import getLogger

logger = getLogger(__name__)

en_words_basic = []

en_words = []


en_lang_symbols = r'[^\w!@#$%\^\-_+=|\\}{\][\"\';:?\/><.,&)(*\s`\u2019]'



class Dummy:
non_en_words_limit = 3

@staticmethod
def _fun(text: str):
words = tuple(w[0].lower() for w in re.finditer(r'[a-zA-Z]+', text))

non_en_pass = [] <<<< Put a breakpoint here. let the BP hit, press F9 to resume program after BP hit, op-code error pops up.
for i, word in enumerate(words):
non_en = []
if not (
word in en_words_basic
or (word.endswith('s') and word[:-1] in en_words_basic)
or (word.endswith('ed') and word[:-2] in en_words_basic)
or (word.endswith('ing') and word[:-3] in en_words_basic)
or word in en_words
or (word.endswith('s') and word[:-1] in en_words)
or (word.endswith('ed') and word[:-2] in en_words)
or (word.endswith('ing') and word[:-3] in en_words)
):

non_en.append(word)
non_en_pass.append(word)
for j in range(1, Dummy.non_en_words_limit):
if i + j >= len(words):
break
word = words[i + j]

if (
word in en_words_basic
or (word.endswith('s') and word[:-1] in en_words_basic)
or (word.endswith('ed') and word[:-2] in en_words_basic)
or (word.endswith('ing') and word[:-3] in en_words_basic)
or word in en_words
or (word.endswith('s') and word[:-1] in en_words)
or (word.endswith('ed') and word[:-2] in en_words)
or (word.endswith('ing') and word[:-3] in en_words)
):
break
else:
non_en.append(word)
non_en_pass.append(word)

else:
logger.debug(f'Non EN words: {non_en}')
return False

if non_en_pass:
logger.debug(f'Non EN words on pass: {non_en_pass}')
pass

@staticmethod
def _re_fun( text):
Dummy._fun(text)

@staticmethod
def _re_re_fun(text):
Dummy._re_fun(text)
1

Since 2017.4 release few days ago I didn't experience the issue. Can't reproduce with siddarth sen's code either.

0

I am able to reproduce this on:

PyCharm Community Edition 2017.1.4
Build #PC-171.4694.38, built on June 13, 2017
JRE: 1.8.0_112-release-736-b21 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 7 6.1

While trying to generate the reproducible code, I noticed the issue occurs based on location of BP and number of local variables in the function as well as depth of function stack when the BP is hit.

Try increasing depth of call stack and other local variables. After the BP is hit, need to press resume(F9) for it to pop up. Sometimes putting in a conditional BP also triggers it.

0

I had what I think is the same problem, I got SystemError: unknown opcode while running in the debugger. Unfortunately I was unable to reproduce the error (the code parses a website, so it doesn't do the exact same thing everytime). I recently upgraded to Python 3.6 from 3.5, I never saw this error under 3.5. The details of my setup are:

PyCharm Community Edition 2017.1.4
Build #PC-171.4694.38, built on June 13, 2017
JRE: 1.8.0_112-release-736-b21 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 7 6.1

and I'm using Python 3.6.1

0

I can reproduce siddarth sen's error (using the setup I gave above)

0

Hi everyone! Finally we've managed to reproduce the problem with siddarth sen's example and the work is in progress. Thank you very much for your feedback!
Feel free to follow this bug report in our issue tracker: https://youtrack.jetbrains.com/issue/PY-24022

0

Hi,
Just in case it helps your investigation. I am running:

PyCharm Community Edition 2017.1.4
Build #PC-171.4694.38, built on June 13, 2017
JRE: 1.8.0_112-release-408-b6 x86
JVM: OpenJDK Server VM by JetBrains s.r.o
Windows 10 10.0

I only receive the error when I am using the F9 to jump between breakpoints. I didn't face any problem when I am using F7 or F8 to navigate the code. Even then if I close the IDE and reopen it, I will not receive the error again. 

This is the code I am using:

def get_file_lines(file_name):
if file_name[-3:] == 'zip':
with ZipFile(file_name) as my_zip:
with my_zip.open(my_zip.filelist[0].filename) as my_file:
for line in my_file:
yield line.decode("utf-8")
else:
with open(file_name, 'rt', encoding='utf-8') as my_file:
for line in my_file:
yield line

I call this function in a loop like:

for line in get_file_lines(file_name):
read_bytes += len(line)
if line_number == 0 or line_number >= start_line:
DO SOMETHING

I will face the error on the If statement.
0

Hi everyone! This bug will be fixed in PyCharm 2017.1.5. We would be really glad if you could help us and check your projects with release candidate: https://confluence.jetbrains.com/pages/viewpage.action?pageId=23004355

1

I got this issue today while debugging a piece of code in my project (550 .py files totalling 1.1 MB)

The issue appeared when I placed a breakpoint to a specific line of code. It would then always happen on the last line of the affected function. No code rearranging helped.

Removing the breakpoint "solved" the issue.

The function was a django validator with a long series of if statements checking for various string values.

 

My *guess* is that setting breakpoints may sometimes affect the code in less than desirable way.

0

Hi Jure! Which PyCharm version you are using? This bug was fixed in 2017.1.5 (Release Candidate build is already live, stable release is planned on next week) and in 2017.2 EAP.

0

2017.1.3. It says it's the latest version.

0

In order to get RC builds you need to switch update policy to Beta Releases or Public Previews in Settings | Appearance & Behaviour | System Settings | Updates | Automatically check update for (assuming you aren't using Toolbox app).

Not sure why it doesn't suggest to update to 2017.1.4 at least, could you restart PyCharm and select Check for updates manually?

0

I did check for updates manually. I may have opted out of upgrading to 2017.1.4 when it was released (ignore this update), so maybe that's why it's not reported.

Anyway, I'll just wait for 2017.1.5 to be released into stable channel. I don't need cutting-edge, just that things work for me.

0

I just ran into this problem using PyCharm 2018.2.  Code that ran with no trouble ten days ago is now failing.  The PYDEVD_USE_FRAME_EVAL hack is helping.

0

Hi Rob Richardson! Could you please create an issue in our issue tracker: https://youtrack.jetbrains.com/issues/PY and attach a code sample to reproduce the problem?

0

Thank you for your reply, Elizabeth.  Unfortunately, I am unable to comply for two reasons.  First, the issue is no longer happening.  Second, while I was able to see bug reports at the page you gave, I was unable to find a way to add a bug report.  Could you please explain how to do that?

0

Same problem. I get unknown opcode when a break point is hit in a specific part of code.  
WA works for me.

0

请先登录再写评论。